For this periodic function Write a MATLAB code in a loop exp

For this periodic function, Write a MATLAB code in a loop expand the Fourier series to n=5000 and plot the function

Where the Fourier series is

Please follow the eqations above to provide the code.

f(t) = , 1 1 0

Solution

Matlab Code

ao = 0;
for i =1:5000
    a(i) = 0;
    b(i) = (1 + cos(2*i*pi) - 2*cos(i*pi))/(i*pi);
end
t = 0:0.01:2;
g=@(t)0;
for i=1:5000
    f = @(t)b(i)*sin(i*pi*t);
    g = @(t)(g(t)+f(t));
end
plot(t,g(t))

For this periodic function, Write a MATLAB code in a loop expand the Fourier series to n=5000 and plot the function Where the Fourier series is Please follow th

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site