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 Commenti

Torsten
Torsten il 13 Ott 2022
Modificato: Torsten il 13 Ott 2022
We don't know what diff_M is.
But note that if length(v) = n, length(diff(v)) = n-1.
Can you provide the 'diff_M' data so that I could try from my end?

Accedi per commentare.

Risposte (1)

Benjamin Drewry
Benjamin Drewry il 19 Ott 2022
Replace 'diff' with 'gradient' to prevent vector mismatches and errors to the plot call

Categorie

Scopri di più su MATLAB in Centro assistenza e File Exchange

Tag

Richiesto:

il 13 Ott 2022

Risposto:

il 19 Ott 2022

Community Treasure Hunt

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

Start Hunting!

Translated by