Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Compare 2 histograms, when "hist" is in a subplot
Replies: 2   Last Post: Jul 3, 2014 12:54 AM

 Messages: [ Previous | Next ]
 Peter Posts: 105 Registered: 7/24/10
Compare 2 histograms, when "hist" is in a subplot
Posted: Jun 30, 2014 4:01 AM

I plot 2 histogram *subplots*. I want to compare them, not just by eye. I want to plot hist(A) - hist(B). That is, they look similar. But I want to plot the difference of the histograms.

The Help tells me I can return the 'hist' values - ie the "qty" per "bin".

step 1: z(1)=hist(E(1,:),nbins);
step 2: z(2)=hist(E(2,:),nbins);
step 3: "plot something using z(1)-z(2)"

But I the first 2 histograms are in a subplot and that messes things up:

subplot(1,3,1), hist(E(1,:),nbin) - that works
subplot(1,3,1), z(1)=hist(E(1,:),nbin); - that doesn't work

Note: I don't want to subtract curve B from curve A and then "hist". I want to compare the 2 histograms.

Will appreciate any help.

Thanks

Date Subject Author
6/30/14 Peter
6/30/14 Casper
7/3/14 Peter