Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Develop MATLAB functions to obtain (1) discrete time Fourier series and (2) inve

ID: 2079885 • Letter: D

Question

Develop MATLAB functions to obtain (1) discrete time Fourier series and (2) inverse discrete time Fourier series of a discrete time signal. Verify these functions using the signals from Problem 4.4 as well as problem 4.6 (b) and (c)

Problem 4.4 Signal:

            Consider the following periodic signal:

x(n)={…,1 ,0 ,1 ,2 ,3 ,2 ,1 ,0 ,1 ,…}

Sketch the signal x(n) and its magnitude and phase spectra.

Using the results in part (a), verify Parseval’s relation by computing the power in the time and frequency domains.

Problem 4.6 (b) signal

x(n)=cos(2n/3)+sin(2n/5)

Problem 4.6 (c) signal

x(n)=cos(2n/3) sin(2n/5)

Explanation / Answer

close all;
clc;
clear all;

x=[1,0,1,2,3,2]; % one period of the signal
N=6; % Peiod of signal
w=(2*pi)/N;
a=[];
% Discrete fourier series
for k=1:10
temp1=0;
for n=2:(N+1)

e= exp(-j*(k-1)*w*(n-2));
temp=x(n-1)*e;
temp1=temp1+temp;
end
a(k)=(temp1/N);
end


% Inverse Discrete Fourier series
for n=1:10
temp1=0;
for k=2:(N+1)

e= exp(j*(n-1)*w*(k-2));
temp=a(k-1)*e;
temp1=temp1+temp;
end
x1(n)=(temp1);
end

disp(x1);   
disp(x);

magnitude= abs(a);
k=0:9;
subplot(1,2,1);
stem(k,magnitude);
Ang=angle(a);
subplot(1,2,2);
stem(k,Ang);

% parsevals theorem
E1=sum(magnitude(1:N).*magnitude(1:N)) % Energy in Frequency domain
E2=sum(x.*x); % Energy in Time domain
E2=E2/N

%% Change the input signal for the rest of inputs

Dr Jack
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote