image thumbnail

CCS IIR Filter verrification via MATLAB

by

 

This is CCS project that implement an IIR Order 4 Filter.

MyFFT(x,N,Fs)
function MyFFT(x,N,Fs)
%MyFFT(x,N,Fs)
%              x-  input signal
%              N-  FFT order
%              Fs- Sampling Frequency
Y=abs(fft(x,N))/N;
YY=20*log10(Y(1:N/2));
if(Fs>N)
    f=[0:Fs/N:Fs/2-1];
else
    f=(Fs/N)*[0:N/2];
end;
if(Fs/2<10e3)
    plot(f,YY);
    xlabel('Frequency [Hz]');
    ylabel('Magnitude [dB]');
end;
if(Fs/2>1e3 && Fs/2<1e6)
    plot(f/1e3,YY);
    xlabel('Frequency [kHz]');
    ylabel('Magnitude [dB]');
end;
if(Fs/2>1e6)
    plot(f/1e6,YY);
    xlabel('Frequency [MHz]');
    ylabel('Magnitudine [dB]');
end;

Contact us