How can I process (plot, substract etc.) two vectors of different lengths?

>> load('rainfallMelbourneData.mat')
_____________________________
=> (Also, see .mat attached)
____________________________________________________
>> plot(x,y)
"Error using plot
Vectors must be the same lengths."
Tried...
>> plot(x', y')
... but got same error.

Answers (1)

ny1 = numel(y);
ynew = interp1((1:ny1)',y,linspase(1,ny1,numel(x))');
plot(x,ynew);

2 Comments

Thank you for your timely answer, Andrei.
However, it returns another error:
"Undefined function or variable 'n'."

Sign in to comment.

Asked:

on 2 Jun 2014

Commented:

on 2 Jun 2014

Community Treasure Hunt

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

Start Hunting!