I am having a terrible time trying to figure out how to plot this function in matlab:
$$\frac{1}{\pi} + \frac{1}{2}\sin(4t) - \frac{2}{\pi} \sum\limits_{k=2,4,6,8}\frac{\cos(4kt)}{k^2-1}$$
I am not sure how to incorporate the summation.
You should really read the manuals and online tutorials. Since I'm in a mellow mood:
I did this in Octave so YMMV...
function y = f(t) y = 1/pi+1/2*sin(4*t); for k = 2:2:8 y = y-2/pi*cos(4*k*t)/(k^2-1); endfor endfunction
Then do something like:
t = 0:.1:10; plot(t, f(t)) # or Conrad's suggestion... fplot(@f,[0,10])
Copyright © 2021 JogjaFile Inc.
You should really read the manuals and online tutorials. Since I'm in a mellow mood:
I did this in Octave so YMMV...
Then do something like: