问题
i have a this following equation of sine wav
Fs = 8000; % Sampling rate of signal
Fc = 3000; % Carrier frequency
t = [0:Fs-1]'/Fs; % Sampling times
dev = 50; % Frequency deviation in modulated signal
s1 = sin(2*pi*200*t)+2*sin(2*pi*f*t);
now i want to value of f for s1 equation how can we get this? thanks
回答1:
You may want to look around SO for similar questions.
The FFT is the simplest route to a solution:
spec = abs(fft(s1));
Then search for the maxima in the spectrum using a detection threshold.
Example (here f=10
):
f= 10;
s1 = sin(2*pi*200*t)+2*sin(2*pi*f*t);
thresh = 0.2;
f1=abs(fft(s1))/sum(abs(s1));
f= [0:length(f1)-1]/length(f1)*Fs;
f(f1(1:end/2)>0.2)
This is the result (the frequencies in the spectrum for peaks with amplitude greater than the threshold value):
ans =
10 200
来源:https://stackoverflow.com/questions/18672158/find-value-of-frequency-form-sin-wav