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 ExchangeMATLAB についてさらに検索

タグ

質問済み:

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