plot unequal length vectors
조회 수: 2 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (2개)
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...
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!