sampled signal fft signal

조회 수: 6 (최근 30일)
yuval ohayon
yuval ohayon 2018년 11월 29일
댓글: yuval ohayon 2018년 12월 1일
hi,i have a task that i dont get it how to be done.
i have sampled ecg signal with fs=1024 hz (vector )
the task is to plot the pulses per minute (1/min) of the ecg signal
s1 is the sampled vector
b=fft(s1)
a=length(s1)
w=0:(2*pi/a):2*pi*(a-1)/a)
well the axix on w,how the fs get in the work ,it must be that i need changing 1 min= 60s=60000ms
please help
i.e the signal is harmonic signal with doubles frequencies of the original frequency signal
  댓글 수: 1
yuval ohayon
yuval ohayon 2018년 11월 29일
anyone help/?
how do i scalinig the function

댓글을 달려면 로그인하십시오.

채택된 답변

David Goodmanson
David Goodmanson 2018년 11월 30일
Hi yuval,
You don't have to bother with omega since the fft operates with straight frequency. I arbitrarily picked the number of points for a data set, and you supplied fs.
N = 10000;
fs = 1024;
delt = 1/fs; % time array spacing, by definition
t = (0:N-1)*delt;
For the frequency array, the following is always true for ffts:
delf = fs/N; % frequency array spacing (Hz), fft rule
f = (0:N-1)*delf;
Now for the fft and rescaled frequencies. The frequency spectrum plot is done in the usual way by taking absolute value, plotting positive frequencies only and doubling the result except fot the dc term. You will see peaks at 120 and its harmonics.
% first, make up some data, 120 bpm = 2 bps
f0 = 2;
y = exp(-10*mod(t,1/f0)+(.4)*rand(1,N));
figure(1)
plot(t,y)
% ----------------
% frequency domain calc
z = fft(y)/N;
f = f*60; % rescale frequencies from per sec to per min <==
% plot
halfN = floor((N+1)/2);
f_plot = f(1:halfN);
absz_plot = abs(z(1:halfN));
absz_plot(2:end) = 2*absz_plot(2:end); % don't double f = 0 (dc)
figure(2)
plot(f_plot,absz_plot)
xlim([0,1200]) % optional
(Technically if N is even you should not double the last element in absz_plot either, but I will not hassle with that detail here. The whole process of half the frequencies, abs, double, etc. kind of sucks anyway).
  댓글 수: 6
yuval ohayon
yuval ohayon 2018년 12월 1일
f=(0:a-1)*(fs/N) %%fft rule fs/n array
F_W=fft(s1)/N %%normelaize amplitude
F_per_min=f*60 %%rescale bps to bpm
b=floor(a+1)/2
b_axix=F_per_min(1:b)
Y_axix=abs(F_W(1:b))
figure(2)
plot(b_axix,Y_axix)
xlim([0 2000])
xlabel('bpm[rad/min]')
ylabel('F_W(ecg(w)')
yuval ohayon
yuval ohayon 2018년 12월 1일
david,why its neccesery changing a=length(s1)====>b,why i shorted the w axix by 2?
thats the diffference?
(if only need to change the f =60*f and normelaiz amplitude)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by