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.

답변 (1개)

Andrei Bobrov
Andrei Bobrov 2014년 6월 2일
편집: Andrei Bobrov 2014년 6월 2일
ny1 = numel(y);
ynew = interp1((1:ny1)',y,linspase(1,ny1,numel(x))');
plot(x,ynew);

댓글 수: 2

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

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

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

질문:

2014년 6월 2일

댓글:

2014년 6월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by