Attempting to make an amplitude v frequency plot
Show older comments
still wrapping my head around how matlab creates its plots. After performing a simple fourier series to my function i am left with:
a_n = 4/(n*pi)*sin((n*pi)/2)
were n is from -5 --> 5. The simple code I used is giving me a matrix mismatch error. Im really just not getting it:
n = -5:1:5;
a_n = 4/(n*pi).*sin(n*pi/2);
plot(n,a_n);
Error using / Matrix dimensions must agree.
Error in Untitled (line 14) a_n = 4/(n*pi).*sin(n*pi/2);
Standard error. Im after a simple line plot with the x-axis to represent frequency (-5wo, -4wo, ...4wo, 5wo) and the y-axis to be the representation of a_n. Performing this by hand is simple enough, but Id really like to be able to present a generated graph instead of a hand drawn one for this lab report.
Thanks in advance.
Accepted Answer
More Answers (0)
Categories
Find more on Mathematics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!