sampled signal fft signal
7 次查看(过去 30 天)
显示 更早的评论
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
采纳的回答
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).
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!