Find the Fourier coeffcients for this function Must be in MA

Find the Fourier coeffcients for this function. Must be in MATLAB code

Consider the periodic function f(t) = 1 - t^2, - 1 lessthanorequalto t lessthanorequalto 1, T = 2 Find the Fourier coefficients for this function. Plot the function and its Fourier approximation between t = -2 and f = 2. For the Fourier approximation, use K = 5, 11 and 51. How many terms in the Fourier series are required for good resolution of the function?

Solution

clear all, close all, clc
syms A0 Ak Bk Ck dt fn k t T0 W0 Y % declaring variables
%DEFINE FUNCTION
% fn=t;
%FIND FOURIER COEF\'s
W0=1; %define W0=1 fundamental frequency
T0=(2*pi); %Period of the function
AK=(2/T0)*int(t*cos(k*t*W0),t,-(T0/2),(T0/2));
BK=((2/T0)*int(t*(sin(k*t*W0)),t,-(T0/2),(T0/2)));
CK=(1/T0)*int(t*exp(-j*k*W0*t),t,-(T0/2),(T0/2));
%SIMPLIFY THE COEF\'s
Ak=simplify (AK)
Bk= round(BK)
Ck=simplify (CK)
%INITIALIZE VARIABLES
dt=T0/100;
%CALCULATE A0
A0=(1/T0)*int(t),t,-(T0/2),(T0/2);
t=[-pi:dt:pi]; %the variable limits and resolution
Y=zeros(size(t));
%PLOT FUNCTION
    for k=[1:2:21];
        y=A0/2+Ak*cos(k*t*W0)+Bk*sin(k*t*W0);
        %double(y);
        %EZPLOT(y);
% Y=Y+y
    end

%plot(t,Y,\'LineWidth\',2);
axis([-4 4 -4 4]);
grid;
xlabel(\'time, s\');
ylabel(\'f(t), (V)\');

Find the Fourier coeffcients for this function. Must be in MATLAB code Consider the periodic function f(t) = 1 - t^2, - 1 lessthanorequalto t lessthanorequalto

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site