Hi guys. I am struggling with a homework question.
*A triangular wave with period T may be written as: 1/(2n+1)^2 * cos((2n+1)*w0*t) (this is a series, n starts at 0 and goes on until infinity). where w0 = 2pi/T. This wave form is sampled, with a sampling time of TS = T/200, to yield the sampled signal x(n).
Use MATLAB to demonstrate how the series converges to the triangular wave.
Generate a plot(properly labelled) with 6, 10 and 30 terms for a value of T = 2.*
The code i inputted into matlab is
t=2; Ts=t/200; w=(2*pi)/t; n=0:9999; x=((2*n+1).^-2).*(cos((2*n+1)*w*Ts)); plot(x)
When i plot this it doesn't give a triangular wave. I must have done something wrong or missed a detail. Any help would be appreciated.
Thank you very much