I have two hist3 figure as:
Ctr = {1.5:0.5:4.5 0.1:0.1:0.9};
hist3([[1;2.7; 3.6], [0.25;.36;.84]],'Ctrs',Ctr);
hist3([[1.2;1.7; 2.6], [0.17;.46;.94]],'Ctrs',Ctr);
I want two have the addition of these two histograms, how is it possible?

8 Comments

By "addition" you mean
A=[[1;2.7; 3.6], [0.25;.36;.84]];
B=[[1;2.7; 3.6], [0.25;.36;.84]];
>> figure
>> hist3([A;B],'Ctrs',Ctr);
?
No. A and B are different matrices, you have changed the problem statement. Please notice the question.
jonas
jonas on 8 Sep 2018
"I want two have the addition of these two histograms, how is it possible?"
The problem statement is ambiguous. Take some time to clarify.
dpb
dpb on 8 Sep 2018
I haven't "changed" anything -- I took a guess as to what the problem actually might be; I "noticed" the Q?; what I didn't notice was anything that actually described what was meant.
Let's say at each iteration we have different xi and yi as the observed data. When we plot them using hist3 we can see the density of points at grid. When xi+1 and yi+1 come out the density at each point of grid changes, i.e., the density is hist3 for all previous untill xi and yi plus xi+1 and yi+1. Simply we can say that at each iteration hist3 including all past data must be summed by the new observed data.
Sorry if I still don't understand but perhaps this is related to your older question that I replied to about an hour ago?
Basically, my take on this is the following. You have two iterations over some range of x-data, say
x1=[1;2;3;4]
x2=[1;2;3;4]
and
y1=[1;2;3;4]
y2=[2;2;3;3]
If you want to show both iterations in the same hist3 plot, then you need to concatenate the data:
yt = [y1;y2]
xt = [x1;x2]
hist3([xt,yt])
I believe this is exactly what dsp said, so perhaps this is not what you want?
Thank you. I misunderstood. It is exactly what I want.
jonas
jonas on 8 Sep 2018
My pleasure, happy to help!

Sign in to comment.

Answers (0)

Commented:

on 8 Sep 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!