plot unequal length vectors

3 ビュー (過去 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 Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by