how to do FFT from signal figure

1 view (last 30 days)
borhan VA
borhan VA on 20 Dec 2018
Commented: borhan VA on 23 Dec 2018
Hi
i used this code to plot ecg signals, now how can i use FFT (fast fourie transform ) code to my signal ?
function plotATM(a02m)
infoName = strcat('a02m', '.info');
matName = strcat('a02m', '.mat');
Octave = exist('OCTAVE_VERSION');
load(matName);
fid = fopen(infoName, 'rt');
fgetl(fid);
fgetl(fid);
fgetl(fid);
[freqint] = sscanf(fgetl(fid), 'Sampling frequency: %f Hz Sampling interval: %f sec');
interval = freqint(2);
fgetl(fid);
if(Octave)
for i = 1:size(val, 1)
R = strsplit(fgetl(fid), char(9));
signal{i} = R{2};
gain(i) = str2num(R{3});
base(i) = str2num(R{4});
units{i} = R{5};
end
else
for i = 1:size(val, 1)
[row(i), signal(i), gain(i), base(i), units(i)]=strread(fgetl(fid),'%d%s%f%f%s','delimiter','\t');
end
end
fclose(fid);
val(val==-32768) = NaN;
for i = 1:size(val, 1)
val(i, :) = (val(i, :) - base(i)) / gain(i);
end
x = (1:size(val, 2)) * interval;
plot(x', val');
for i = 1:length(signal)
labels{i} = strcat(signal{i}, ' (', units{i}, ')');
end
legend(labels);
xlabel('Time (sec)');
% grid on
end
thanks

Accepted Answer

Mark Sherstan
Mark Sherstan on 21 Dec 2018
Follow the example here.
  1 Comment
borhan VA
borhan VA on 23 Dec 2018
hi thank you for your replying but i can't find something usefull ,
I just want to do FFT from my last signal figue that val of value is '4*60000 double' and value of 'x is 1*60000 double"
thanks alot

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!