how to calculate the frequency of a signal ...

Status
Not open for further replies.

savage67

Member level 1
Joined
Sep 25, 2006
Messages
40
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,587
pxx = x.*conj(x)/512;

i m writing a program in matlab to make the fft analysis of the signal which the user determine
but i dont know how to measure the period of tha signal..

how to calculate the frequency or period of a signal which has two component with different frequencies
like A.sin(w1.t)+B.cos(w2.t)
plz help meee
 

It strongly depends upon coeficients A,B,w1, w2.
But in most cases signal would not be periodical but pseudoperiodical if not even nonperidical.
f(t)=A.sin(w1.t)+B.cos(w2.t)

The definition for peridical signals says:
f(t)=f(t+T), where t is time and T period.
so you should solve the equation:
A.sin(w1.t)+B.cos(w2.t) =A.sin(w1(t+T))+B.cos(w2(t+T))
and get T if f(t) would be periodical but I don't thik it is since it has boath frequencies w1 and w2
 

as long as w1 and w2 are far enough, you should see 2 peaks after fft analysis.
 

In help of Matlab you can find an example:

t = 0:0.001:0.6;
x = sin(2*pi*50*t)+sin(2*pi*120*t);
y = x + 2*randn(size(t));
plot(1000*t(1:50),y(1:50))
title('Signal Corrupted with Zero-Mean Random Noise')
xlabel('time (milliseconds)')

X = fft(x,512);
Y = fft(y,512);
Pxx = X.* conj(X) / 512;
Pyy = Y.* conj(Y) / 512;

f = 1000*(0:256)/512;
plot(f,Pyy(1:257))
title('Frequency content of y')
xlabel('frequency (Hz)')

x : periodical signal
y ; with additional noise

Visualisation of Pyy or Pxx reveals the frequency content of the signals y and x
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…