Name: Masood Salik BSEE-14-18 Convergence / Existence of DTFT and Gibbs Phenomenon
Name: Masood Salik BSEE-14-18 Convergence / Existence of DTFT and Gibbs Phenomenon
Name: Masood Salik BSEE-14-18 Convergence / Existence of DTFT and Gibbs Phenomenon
BSEE-14-18
Output:
2. Comment on the frequency of oscillations as 𝑀 is increased.
With increase in M, Oscillations are damped.
5. Comment on the convergence of the partial sum at the point of discontinuity for
different values of 𝑀
Matlab Code:
%% ========================================================================
%%Code Modified by Masood Salik
% Specification
A = 1; % Peak-to-peak amplitude of square wave
Tau = 1; % Total range in which the square wave is defined (here -0.5 to
0.5)
T0 = 2; % Period (time of repeatation of square wave), here 10
C = 200; % Coefficients (sinusoids) to retain
N = 1001; % Number of points to consider
t = linspace(-(T0-Tau),(T0-Tau),N); % Time axis
X = zeros(1,N); X(t>=-Tau/2 & t<=Tau/2) = A; % Original signal
R = 0; % Initialize the approximated signal
k = -C:C; % Fourier coefficient number axis
f = zeros(1,2*C+1); % Fourier coefficient values
if c==1
subplot(3,2,c); plot(t,X,t,R,'m','LineWidth',3); axis tight; grid
on;
xlabel('w/pi'); ylabel('Amplitude');
title(['Approximation for N = ', num2str(c),...
'. Overshoot = ',num2str(Overshoot),'%'])
else if c==3
subplot(3,2,2);
plot(t,X,t,R,'m','LineWidth',3); axis tight; grid on;
xlabel('w/pi'); ylabel('Amplitude');
title(['Approximation for N = ', num2str(c),...
'. Overshoot = ',num2str(Overshoot),'%'])
else if c==7
subplot(3,2,3);
plot(t,X,t,R,'m','LineWidth',3); axis tight; grid on;
xlabel('w/pi'); ylabel('Amplitude');
title(['Approximation for N = ',
num2str(c),...
'. Overshoot = ',num2str(Overshoot),'%'])
else if c==19
else if c==50
xlabel('w/pi'); ylabel('Amplitude');
else if c==200
xlabel('w/pi'); ylabel('Amplitude');
end
end
end
end
end
%% ========================================================================