"Matrix dimensions must agree" when trying to plot the sum of a sin function
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Dyuman Joshi
le 3 Déc 2022
What exactly are you trying to plot?
Is n just equal to 20 or is it equal to 20 * (sum of the series) ?
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Legend dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!