"Matrix dimensions must agree" when trying to plot the sum of a sin function
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Jordi van Selm
am 3 Dez. 2022
Kommentiert: Jordi van Selm
am 3 Dez. 2022
x=[-pi:pi/100:2*pi]
figure
for n=20
m = (1:n).';
s2 = sin((2*m-1)*x)/(2*m-1);
plot(x,s2, 'displayname', "\alpha = " + n);
hold on
end
legend show
I get this error when I'm trying to plot for n = 20
What did I do wrong?
2 Kommentare
Dyuman Joshi
am 3 Dez. 2022
What exactly are you trying to plot?
Is n just equal to 20 or is it equal to 20 * (sum of the series) ?
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Legend finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!