"Matrix dimensions must agree" when trying to plot the sum of a sin function
1 view (last 30 days)
Show older comments
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 Comments
Dyuman Joshi
on 3 Dec 2022
What exactly are you trying to plot?
Is n just equal to 20 or is it equal to 20 * (sum of the series) ?
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Legend in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!