Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoLuong committed Mar 22, 2024
1 parent 943959b commit 42f63bb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
20 changes: 20 additions & 0 deletions private/myhistc.m
@@ -0,0 +1,20 @@
function col = myhistc(x, t)
% col = myhistc(x, t)
% as [~, col] = histc(x,t) but with specific col value for x == max(t)
% that does not take the last index, meaning the last bin contains also the
% right bound

[~, col] = histc(x,t); %#ok
n = length(t);
b = col == n;
if any(b)
tmax = t(end);
for colmax = n:-1:1
if t(colmax) ~= tmax
break
end
end
col(b) = colmax;
end

end % myhistc
10 changes: 10 additions & 0 deletions private/mynormest.m
@@ -0,0 +1,10 @@
function nA = mynormest(A)
% nA = mynormest(A)
% Estimate 2-norm of matrix A

if issparse(A)
nA = normest(A);
else
nA = norm(A);
end
end

0 comments on commit 42f63bb

Please sign in to comment.