How to put specific frequency in a specific bin in frequency domain?

1 view (last 30 days)
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.
%% freq spacing
for j=1:M
f_spac(j)=(1+m(j)*r)*f_d; %freq spacing
%% 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];
B = reshape(f,[1,N]);
fs=20*f(N/2); % Sampling frequency
Ts=1/fs; % Sampling time
t=0:Ts:1e3*Ts; % Time vector

Answers (1)

Raunak Gupta
Raunak Gupta on 16 Mar 2020
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.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!