Time domain to Frequncy domain signal conversion

3 次查看(过去 30 天)
This is my program to generate time-amplitde ECG signal, now i want to convert this output signal into frequency-amplitude domain. I tried using FFT technique but it is invalid taking fft(x,y). Please Help
A=dlmread('samples (7).csv',',',2,0);
x= A(2:1:14761 ,1);
y= A(2:1:14761 ,2);
figure;
%z=f(x,y);
hold on;
z=plot(x,y);
xlabel('Time(sec)')
ylabel('Amplitude(mV)')
axis tight;
grid on;

回答(1 个)

Star Strider
Star Strider 2019-2-27
Use the Signal Processing Toolbox spectrogram (link) function to do time-frequency analysis.
  2 个评论
vandana sharma
vandana sharma 2019-2-27
i do not want to do the time-frequency analysis, i want to convert/plot the same time-ampltude domain signal into frequency-amplitude domain.
Star Strider
Star Strider 2019-2-27
Try this:
filename = 'samples (7).csv';
[D,S] = xlsread(filename);
t = D(:,1);
EKG = D(:,2);
figure
plot(t, EKG)
grid
L = numel(t); % Data Row Size
QF = std(diff(t)); % Check For Non-Uniform Sampling
tr = linspace(min(t), max(t), L); % Time Vector For Resampling
EKGr = resample(EKG, tr); % Resampled EKG
Ts = mean(diff(t)); % Sampling Interval (s)
Fs = 1/Ts; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency (Hz)
FT_EKG = fft(EKGr-mean(EKGr))/L; % Fourier Transform (Offset Corrected)
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:numel(Fv); % Index Vector
figure
plot(tr(1:500), EKGr(1:500))
grid
figure
plot(Fv, abs(FT_EKG(Iv)))
grid
xlim([0 50])
xlabel('Frequency (Hz)')
ylabel('Amplitude (mV)')

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by