MATLAB Assignment-Fourier Series and Fourier Transforms
MATLAB Assignment-Fourier Series and Fourier Transforms
Tiruchirappalli Campus
% Calculate a_0
a0 = (1/(2*pi)) * int(f, x, -pi, pi);
% Calculate a_n
an = (1/pi) * int(f * cos(n*x), x, -pi, pi);
% Calculate b_n
bn = (1/pi) * int(f * sin(n*x), x, -pi, pi);
for k = 1:N
fs = fs + double(subs(an, n, k)) * cos(k*x_vals) + double(subs(bn, n, k)) *
sin(k*x_vals);
end
Note:
In the place of R use your register number and submit the output.
Only change the function in the respective places in the given MATLAB Code.
You can login with your srmist mail id.
SRM Institute of Science and Technology
Tiruchirappalli Campus
Exercise Problems:
1. Find the Fourier Transform for the function f(t)= sin (R*pi*f0*t), by using MATLAB.
2. Find the Fourier Transform for the function f(t)=exp (R*pi*f0*t), by using MATLAB.
Note:
In the place of R use your register number and submit the output.
Only change the function in the respective places in the given MATLAB Code.