I'm trying to figure out why after i run this code I'm not getting any messages and no plots are popping up

1 次查看(过去 30 天)
if true
%close all
clear all
num_fft=1024;
dt=1;
f= [ 0 0 0 0 1 0 0.5 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0]
h=[ 2.76077e-006 0.000746586 0.0407636 0.449702 1.02038 0.673993 0.540762,... 0.225414 0.0211304 0.0411355 0.44933 1 0.449329 0.040762 0.000746586,... 2.76077e-006 0 0 0 0 0 0 0 0]
N= numel(h);
for i = 1:N
x(i)=(i-1);
H=fft(h,num_fft); %Take the FFT of h
for j=1:num_fft;
dfh(j)=(((1/num_fft*dt))*(j-1))-0.5;%Calculate frequency bins for H
end
HR=real(H);%Calculate real part of H;
HI=image(H);%Calculate imaginary part of H;
for i=1:num_fft;
HM(i)=sqrt((HR(i)^2)+((HI(i)^2)));%calculate magnitude of H components
end
figure(1)
plot((dfh),fftshift(HM),'k');
title('Magnitude of H');
xlabel('freq axis')
ylabel('Magnitude axis');
Htheta = fftshift(atan2(HI,HR));% Calculate the phase for H
figure (2)
plot(dfh,unwrap((Htheta),.1),'k');
title('Phase Angle of H');
xlabel('freq axis')
ylabel('Phase axis')
F=fft(f,num_fft); %Take the FFT of f
for j=1:num_fft
dfg(j)=(((1/num_fft*dt))*(j-1))-0.5;%Calculate frequency bins for F
end
FR=real(F);
FI=image(F);
for i=1:num_fft;
FM(i)=sqrt((FR(i)^2)+((FI(i)^2)));%Calculate magnitude of F components
end
figure(3)
plot((dfh),fftshift(FM),'k');
title('Magnitude of F');
xlabel('Freq axis');
ylabel('Phase axis');
FH=H
for i=1:num_fft;
if FM== 0;
FDF(i)=0;
else
FDF(i)=FH(i)./F(i);
end
end
for j=1:num_fft;
dfg(j)=(((1/num_fft*dt))*(j-1))-0.5;
end
GDFR=real(GDF);%calculate the real part of F;
GDFI=image(GDF);%calculate the imaginary part of F;
for i=1:num_fft;
FDFM(i)=sqrt((GDFR(i)^2)+((GDFI(i)^2)));%Calculate magnitude of F components
end
figure (4)
plot((dfh),fftshift(GDFM),'k');
title('Magnitude of GDF');
xlabel('freq axis')
ylabel('Magnitude axis')
FDFtheta=fftshift(atan2(GDFI,GDFR));%Calculate the phase for F
figure (5)
plot (dfh,unwrap((GDFtheta),.1),'k');
title('Phase Angle of GDF');
xlabel('freq axis');
ylabel('Phase axis');
Fdf=ifft(GDF,num_fft);
Plot(GDF,'k');
title('unknown g')
xlabel('freq axis');
ylabel('Phase axis');
end

回答(1 个)

Image Analyst
Image Analyst 2013-12-16

类别

Help CenterFile Exchange 中查找有关 Audio Processing Algorithm Design 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by