how to find an amplitude value in frequency domain for a specific frequency while i'm having a CW signal in time domain?
조회 수: 3 (최근 30일)
이전 댓글 표시
hi guys. i created a signal CW in time domain with Gaussian noise. i need to to check what is the amplitude value in several specific frequencies? by doing FFT i do not get a good result, so i taught using the formula x[n]*e^(-i*2*pi*f*t), while f is a small vector of the specific frequencies which i need to check the amplitude values of them. i'll be more specific: i'm doing FFT to check the f_peak(which gives the maximum amplitude) and then i want to check by using the formula if there is any other frequency near by the f_peak(such as f_peak+0.001 Hz) which gives a better result for a maximum value in frequency domain. my question is how can i do that?
this is the code i wrote for building the CW signal in time domain and the code i wrote for finding the maximum value in FFT::
N=1500; Fs=10000; %frequency sample [sample per second] Ts=1/Fs; %Time sample [sec] time=(0:N-1)*Ts; %time vector [sec] x=0.707*sin(2*pi*4500*time); %sinusoid function in 4.5KHz frequency X=2*randn(size(x))+x; %sinusoid function plus AWGN
No=2^nextpow2(length(X)); %number of bins in the FFT (No=2048) zero_samp=No-length(time); %number of zero padding time=(0:No-1)*Ts; x_zero=[x zeros(1,zero_samp)]; %sinusoid function with ZERO PADDING
X_Zero=2*randn(size(x_zero))+x_zero; %sinusoid function plus AWGN with ZERO PADDING
%------------time domain------------
figure(1)
plot(1000*time,X_Zero)
xlabel('time [msec]')
ylabel('amplitude [volt]')
Y=fft(X_Zero,No);
Py=abs(Y)/No;
f_resolution=Fs/No;
f=0:f_resolution:Fs/2-1; %vector frequencies of the possitive values
Y_dB=20*log10(Py); %power dB
%-----------frequency domain--------
figure(2)
[Maximum,f_peak_index]=max(Y_dB);
f_peak=f(f_peak_index);
plot(1/1000*f,Y_dB(1:No/2))
hold on
xlabel('frequency [KHz]')
ylabel('amplitude [dB]')
plot(1/1000*f_peak,Maximum,'rx')
댓글 수: 0
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!