matlab hanging for the below code
Mostrar comentarios más antiguos
Fs=10
t=0:1/Fs:1
x1=cos(2*pi*t*3)+cos(2*pi*t*4)+cos(2*pi*t*8)+cos(2*pi*t*10)
fft_x1=fft(x1)
fft_shift=fftshift(fft_x1)
mag=abs(fft_shift)
N=length(t)
f=-Fs/2:Fs/N:Fs/2-(Fs/N)
stem(f,mag)
fr=[]
for k=1:N
sum=0
for n=1:N
out=x1(n)*exp((-i*pi*2*n*k)/N)
sum=sum+out
end
fr=[fr sum]
end
fr=fftshift(fr)
mag1=abs(fr)
plot(t,x1)
title('signal time')
stem(f,mag1)
for this code matlab is hanging ,but for other programs matlab is working fine what is the problem in the code
Respuesta aceptada
Más respuestas (1)
Raj
el 3 de Dic. de 2019
0 votos
Doesn't seem to be hanging for me!

Where are you having problem? Have you tried running in Debug mode?
1 comentario
Walter Roberson
el 3 de Dic. de 2019
It does not hang for me either.
Categorías
Más información sobre Entering Commands en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!