How to put specific frequency in a specific bin in frequency domain?
1 view (last 30 days)
Show older comments
I have eight tones as represented by f, and I want to the distance between every two tones is different as shown in the figure,
I have the frequency spacing, but I need to put the tones properly, and I need the resolution and the number of samples to be suitable for FFT consideration.
N=8;
r=1;
f_d=1e3;
M=4;
m=0:M-1;
fc=2.45e9;
%% freq spacing
for j=1:M
f_spac(j)=(1+m(j)*r)*f_d; %freq spacing
end
%% Generate the frequency vector
for i=1:M
f(:,i)=[fc+((1+m(i)*r)/2)*f_d; fc-((1+m(i)*r)/2)*f_d];
end
B = reshape(f,[1,N]);
fs=20*f(N/2); % Sampling frequency
Ts=1/fs; % Sampling time
t=0:Ts:1e3*Ts; % Time vector
0 Comments
Answers (1)
Raunak Gupta
on 16 Mar 2020
Hi,
I assume you have a time series vector which represents the signal. Taking fft of that will give the frequency response. Since in the above example code, the peak for each tone is clearly visible with no noise you may use findpeaks to find the local maxima. These will give corresponding frequency peaks. If the noise remains low the number of peaks will be equal to the number of tones present. This way by subtracting the successive peaks you can get the distance between each tone.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!