ECG signal proccessing using Fourier tansform. I am trying to plot the frequency spectrum of an ECG signal using fft,without a in built function.I need to give N value(i.e) sample number,in the coding.But if i give it ,am getting error

7 views (last 30 days)
clc;
%% Input fs=1000; figure plot(x);% Plot both signals. axis([0 10 -5 5]);
%% FFT N=length(x); nfft=2^ceil(log2(N)); out=zeros(1,nfft); %% Creating Empty vector array Sum=0; for k=1:nfft for n=1:N Sum=Sum+x(n)*exp(-2*pi*1i*(n-1)*(k-1)/nfft); end out(k)=Sum; Sum=0;% Reset end figure stem(out); axis([0 10 -5 5]);
F=abs(fft(x)); figure,plot(F); xlabel('sample number'),ylabel('amplitude'), title('frequency spectrum');

Answers (0)

Community Treasure Hunt

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

Start Hunting!