Confused on this problem

4 visualizaciones (últimos 30 días)
matthew choo
matthew choo el 25 de Sept. de 2020
Comentada: matthew choo el 25 de Sept. de 2020
I am trying to figure out how to do it but I am confused in writing it.
Attach is my scripts
  1 comentario
matthew choo
matthew choo el 25 de Sept. de 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'),

Iniciar sesión para comentar.

Respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by