Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CRP Toolbox for MATLAB
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Norbert Marwan
CRP Toolbox for MATLAB
Commits
423d4847
Commit
423d4847
authored
17 years ago
by
marwan
Browse files
Options
Downloads
Patches
Plain Diff
some comments added
parent
a6aa96ea
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hist2.m
+13
-4
13 additions, 4 deletions
hist2.m
with
13 additions
and
4 deletions
hist2.m
+
13
−
4
View file @
423d4847
...
...
@@ -25,7 +25,7 @@ function varargout=hist2(varargin)
%
% See also HIST, HISTN, BAR3, MI.
% Copyright (c) 2002-200
3
% Copyright (c) 2002-200
7
% Andre Sitz, Norbert Marwan, Potsdam University, Germany
% http://www.agnld.uni-potsdam.de
%
...
...
@@ -33,6 +33,9 @@ function varargout=hist2(varargin)
% $Revision$
%
% $Log$
% Revision 1.10 2006/07/04 14:05:08 marwan
% lag = zero allowed
%
% Revision 1.9 2004/11/10 07:05:37 marwan
% initial import
%
...
...
@@ -82,15 +85,21 @@ if size(x,1)<size(x,2), x=x';end
if
size
(
y
,
1
)
<
size
(
y
,
2
),
y
=
y
'
;
end
x
=
x
(:,
1
);
y
=
y
(:,
1
);
%x=x(:); y=y(:);
x1
=
(
x
-
min
(
x
))/
max
(
x
-
min
(
x
))
-
eps
;
y1
=
(
y
-
min
(
y
))/
max
(
y
-
min
(
y
))
-
eps
;
% normalise the value range to [0 1)
x1
=
(
x
-
min
(
x
))
/
max
(
x
-
min
(
x
))
-
eps
;
y1
=
(
y
-
min
(
y
))
/
max
(
y
-
min
(
y
))
-
eps
;
if
length
(
x
)
<=
lag
,
lag
=
length
(
x
)
-
1
;
warning
([
'Lag is too large. Using '
,
num2str
(
lag
),
' instead.'
]),
end
temp
=
fix
(
x1
(
1
:(
end
-
lag
))
*
nbin
)
+
(
fix
(
y1
((
lag
+
1
):
end
)
*
nbin
))
*
nbin
;
% this is the main trick: put the first data to values [1:1:nbin] and the second data to [nbin:nbin:nbin^2]
temp
=
fix
(
x1
(
1
:(
end
-
lag
))
*
nbin
)
+
(
fix
(
y1
((
lag
+
1
):
end
)
*
nbin
))
*
nbin
;
% call Matlab histc function (faster than hist)
p
=
histc
(
temp
,
0
:(
nbin
^
2
-
1
))
'
;
p2
=
reshape
(
p
,
nbin
,
nbin
)/
length
(
x
);
% create the correct bin denominator
minx
=
min
(
min
(
x
));
maxx
=
max
(
max
(
x
));
if
minx
==
maxx
,
minx
=
minx
-
floor
(
nbin
/
2
)
-
0.5
;
maxx
=
maxx
+
ceil
(
nbin
/
2
)
-
0.5
;
end
miny
=
min
(
min
(
y
));
maxy
=
max
(
max
(
y
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment