rakesh_vnit said:hey...
the period of the signal is just the inverse of the freq of the signal. so, by takin the fft u would get the freq domain description of the signal from which u can find the freq of ur signal. now by takin the inverse of it u will come out wid the period of u signal...
why were u so amazed abt that idea?????
i don't mean you in "wat will be the o/p, the freq domain of the signal... "rakesh_vnit said:hey ...
u got me wrong....
wat u have to find is not fft and ifft of that again....
wat u have to do is the find fft...wat will be the o/p, the freq domain of the signal...now find the point at which this signal is havin the max value....
now here u will have that value to be some interger as u take discrete signal. so, convert it into the analog freq with samplin freq that u might have taken for the signal...
now...the freq that u have got now is the freq of the signal u want(analog).....so the inverse of this would give u the period of this...
i think i am clear now....in case of further doubt i welcome it....try this one and check it...
n chill out...this is just a discussion
yeaSal said:Hi
first of all, I am not sure if your signal is periodic, is it?
Assuming that it is the noisy version of a periodic signal whose period is limited by the high amplitude spikes in your signal, you just need to find the difference between two adjacent spikes, from your figure, it is about 300 samples, each sample is ts = 1/369 sec.
Therefore, the sought period 300/369 is about 0.8 sec
good luck
Sal
clear;
load -mat ecg1.mat;
N = size(ECG_1,1); % number of samples
fs = 369.0; % sample rate
t = (0 : N-1) / fs; % sample times
subplot(2,1,1); plot(t,ECG_1); xlabel('Seconds');
h = fft(ECG_1 > 0.5); % tricky threshold value
% Discard duplicate upper half. Scale frequency and amplitude.
freq = fs * (0 : N/2) / N;
subplot(2,1,2); plot(freq, 2 / N * abs(h(1 : N / 2 + 1))); xlabel('Hertz');
dear rakesh_vintrakesh_vnit said:so, u want to know how to calculate the analog freq from the digatal freq.
here it is ...when u have the index,say k,(i.e, the x-axis value of the fft at which u get the max value...write an algo of how to find the max of the given value n its correspondin value on x-axis).
now, k/N is the digital freq of it, where N is the total samples of the signal u have taken. use the below formula to get the analog freq.
k/N = F/Fs....
where F=the analog freq of the signal u want to find.
Fs= samplin freq of the signal.
so, wid this u would get the analog freq. n the (1/F) would give u the period of the signal...
i think this explanation is good enough for u to write ur own algo...
your wrong is hear:the sampling frequency is:1000/2=500hz
maximum FFT value index is:981
by using your formula:
981/1000=F/500
then F equal 490.5 and the period is 1/490.5=0.002
it is not true.
I want to calculte the period of this signal
what is my wrong?
you can set a threshold and separate the peaks.that's right I calculate the period by this method and the period ti be obtain 0.86
but i want to write a m file to calculate it.therfore i need an algorithm.
salam2000 said:your wrong is hear:the sampling frequency is:1000/2=500hz
maximum FFT value index is:981
by using your formula:
981/1000=F/500
then F equal 490.5 and the period is 1/490.5=0.002
it is not true.
I want to calculte the period of this signal
what is my wrong?
the left peak is that you should consider, it is on 21. then 2/(21-1)=0.1.
the right peak is concluded from the discrete version of you signal. because it isn't continues this part is created symmetry and increase its frequency with increase the number of points. also you can get 2/(1000-981)=0.1. also you can use fftshift in Matlab.
you can set a threshold and separate the peaks.that's right I calculate the period by this method and the period ti be obtain 0.86
but i want to write a m file to calculate it.therfore i need an algorithm.
salam2000 said:Drar active sudent,
why you are in hurry....
-1 is beacase you plot your curve from 1:1000 instead plot from 0:999
I think it's better you have a glance to Oppenheim book before ask question and become hopeless