LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

goertzel algorithm

hi please help me

I wand to write matlab code about " goertzel algorithm" (fft) but i dont want t use fft function

its ot correct where is my mistake?

 

L=3;
N=2.^L;
t=0:2*pi/N:2*pi;
Ft = sin(t);
x=[Ft];
%FFT
X1(1:N)=0;
X2(1:N)=0;
for K1=0:2:N-1
for n1=0:(N/2)-1
X1(K1+1)=X1(K1+1)+x(2*n1+1).*exp(-4j*pi*K1*n1/N);
end
end

for K2=1:2:N-1

for n2=1:(N/2)-1
X2(K2+1)=(X2(K2+1)+x(n2+1).*exp(-4j*pi*K2*n2/N))*exp(-2j*pi*K2/N);
end
end
X=[X1+X2];


figure(1);
plot(t,Ft);
hold on;
stem(t,Ft);title('N-sample from Input signal');
hold off;
figure(2);
stem(abs(X));title('FFT with Goertzel algorithm');
figure(3);
Z=fft(x);
stem(abs(Z));title('FFT with matlab function');
disp Input
disp(x);
disp FFT
disp(Z);

0 Kudos
Message 1 of 2
(3,072 Views)

Is your question related to LabVIEW in some way?

Message 2 of 2
(3,049 Views)