Hi, I wish to draw a histogram of two data, one with length of 60 and

the other with length of 1000, and in the way that readers can see the

difference in black and white. How can I do this ? thank you.

| Hi, I wish to draw a histogram of two data, one with length of 60 and

| the other with length of 1000, and in the way that readers can see the

| difference in black and white. How can I do this ? thank you.

Hi autumn,

See if the following helps:

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/hist.shtml#...

Jeff

Hello,

I assume that you want to show the sample probability density functions, use

the following:

% Make data sets of different lengths.

x=randn(100,1);

y=randn(1000,1)+1;

% Let Matlab find the bin positions that include both data sets.

[dummy, t] = hist([x;y], 20);

nx = hist(x, t); % Sort x into bins.

nx = transpose(nx/sum(nx));

ny = hist(y, t); % Sort y into bins.

ny = transpose(ny/sum(ny));

% Plot bin counts as bars.

bar(t, [nx, ny])

If you just want to show the actual (unnormalized) distributions, use the

same code, but don't divide by sum(nx) and sum(ny).

HTH,

Ken

Quote:> Hi, I wish to draw a histogram of two data, one with length of 60 and

> the other with length of 1000, and in the way that readers can see the

> difference in black and white. How can I do this ? thank you.

Yes, but I cannot set a vector Y where the size of Y(:,1) and Y(:,2)

are different ?

> | Hi, I wish to draw a histogram of two data, one with length of 60 and

> | the other with length of 1000, and in the way that readers can see the

> | difference in black and white. How can I do this ? thank you.

> Hi autumn,

> See if the following helps:

> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/hist.shtml#...

> Jeff

Hello,

I do not understand this message. Who are you replying to? What are Y(:,1)

and Y(:,2)?

Ken

> Yes, but I cannot set a vector Y where the size of Y(:,1) and Y(:,2)

> are different ?

> are different ?

> > | Hi, I wish to draw a histogram of two data, one with length of 60 and

> > | the other with length of 1000, and in the way that readers can see the

> > | difference in black and white. How can I do this ? thank you.

> > Hi autumn,

> > See if the following helps:

Quote:> > Jeff

> Yes, but I cannot set a vector Y where the size of Y(:,1) and Y(:,2)

> are different ?

the same length (the row lengths can be different from the column lengths,

of course.) So for example, this is not a legal set of commands in MATLAB:

A=1:5;

B=1:3;

LA=length(A)

LB=length(B)

[A; B]

You'll receive the error on the last line:

??? Error using ==> vertcat

All rows in the bracketed expression must have the same

number of columns.

_Cell_ arrays will allow you to do this, but many operations (the basic

linear algebra operations, for example) aren't defined for cell arrays. You

may want to pad your arrays to fit them into the same matrix, like:

[A;B zeros(1,LA-LB)]

--

Steve Lord

1. Possible applications of similarity between unequal sized time-sequences

We have developed a code to define degree of similarity between

unequal-sized time sequences. Can anybody suggest possible applications for

this ?

For example, comparing musical scores with unequal rate

Thanks for the feedback.

2. Version 2 of the Shuggy Demo released

4. Replacing the view in a CSplitterWnd

6. Converting Sender's User Name

7. Vectorize Operations between two dissimlar sized Matrices

9. add two different sized vectors

10. How to plot the same data on two different scales?

11. conbining two columns of data into one?

12. two sets of data (with different units) on a single plot

13. data-sharing of two Fortran .dll functions

6 post • Page:**1** of **1**