plot unequal length vectors

조회 수: 2 (최근 30일)
kokomy
kokomy 2015년 9월 2일
편집: dpb 2015년 9월 14일
I have a vector X that I want to use for x-axis. Then I have a matrix Y that I want to use for y-axis unequal length. I want to koow how I can plot(X,Y)? X(size)=1x9901 Y(size)= 2x160000

답변 (2개)

dpb
dpb 2015년 9월 2일
편집: dpb 2015년 9월 14일
All you can do there is create some mapping of an X value for each Y; it makes no sense otherwise other than simply by ordinal position ignoring X entirely. Sorry, wish I had better news, but sometimes one simply has insufficient information.
ADDENDUM
Knowing just what the relative sizes are, specifically, doesn't change the basic problem outlined before. You've got to have some reason to associate a given X value with one from Y. The most obvious would be
plot(X.',Y(:,length(X)).')
which uses the first N values of Y to go with X. Or, if the Y observations are somehow known to stretch over the extent of X but were generated on a different sampling rate, you can either interpolate X or decimate Y to make them commensurate in size. The former could be something like
Xi=interp1(1:length(X),X,linspace(1,length(X),length(Y)));
which will return a linear interpolation of the present X values to the number of elements in Y retaining the approximate shape of the X vector with index but lengthening it to have the same number of elements as Y.
If'en you have the Signal Processing Toolbox, there's also resample which will resample up or down in ratio of integers to go either way...

kokomy
kokomy 2015년 9월 2일
How I can create some mapping of an X value for each Y in matlab
  댓글 수: 1
dpb
dpb 2015년 9월 2일
Any way you wish...you've got to have some idea of what X represents in your case and how do the Y values relate. We can't answer that; we've no klew even as to what they stand for, what more where the values came from...

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by