Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
943959b
commit 42f63bb
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |