Confused on this problem

4 visualizzazioni (ultimi 30 giorni)
matthew choo
matthew choo il 25 Set 2020
Commentato: matthew choo il 25 Set 2020
I am trying to figure out how to do it but I am confused in writing it.
Attach is my scripts
  1 Commento
matthew choo
matthew choo il 25 Set 2020
%Describe clearly how the N-point DFT performed on a signal defined
%x[n]=sin(2*pi*n/100)
%for 0=<n=<100
%for x[n]=0 for n>100
%N=100
%N=1000
N0=100;
n=0:1/50/N0:1/50-1/50/N0;
x_n=sin((2*pi*n)/100)
x_DFT=fft(x_n)
x_CTFS=1/N0*[x_DFT(4)/2,x_DFT(5:6),x_DFT(1),x_DFT(2:3),x_DFT(4)/2]
t=0:1/50/100:1/50;
x_t1=sin((2*pi*n)/100);
x_t2=0;
for nn=-N0/2:N0/2;
x_t2 = x_t2+x_CTFS(nn+N0/2+1)*exp(j*(nn)*2*pi*50*t);
end
figure(1),subplot(2,1,1),plot(t,x_t1) %original x(t)
title('f_s=f_{Nyq}'),xlabel('t'),ylabel('x(t) and x(n)'), hold on
subplot(2,1,1),stem(n,x_n,'fill'),hold off %samples x(n)
figure(1),subplot(2,1,2),plot(t,x_t2) %CTFS representation of the signal
xlabel('t'),ylabel('x(t) from CTFS'),

Accedi per commentare.

Risposte (0)

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by