plot unequal length vectors
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (2)
dpb
am 2 Sep. 2015
Bearbeitet: dpb
am 14 Sep. 2015
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 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!