I need some help with the linspace function

Hey everyone, so whenever I run my code I get "Error using plot Vectors must be the same length" so I tried using linspace but it's still not working. Could I get some help?
T = linspace(1,99,length(diff_M))
M = 1./T;
diff_M3 = diff(M3)
plot(diff_M,T)

댓글 수: 2

Torsten
Torsten 2022년 10월 13일
편집: Torsten 2022년 10월 13일
We don't know what diff_M is.
But note that if length(v) = n, length(diff(v)) = n-1.
Sai
Sai 2022년 10월 18일
Can you provide the 'diff_M' data so that I could try from my end?

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

답변 (1개)

Benjamin Drewry
Benjamin Drewry 2022년 10월 19일

0 개 추천

Replace 'diff' with 'gradient' to prevent vector mismatches and errors to the plot call

카테고리

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

태그

질문:

2022년 10월 13일

답변:

2022년 10월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by