MATLAB: How I get all frequency in FFT result

ffthelp quickly

Hello,
I have a sine signal with many frewuency. I should get the frequency from FFT result.
Please let me know your suggestion.
I should generate the Fc values in frequencies element.
Fs = 5e4;
t = (0:Fs-1)*1/Fs; % Time vector
Datapoints = Fs;
Fc1 = 30:6/Fs:33; %(b-a)*2
Fc2 = sort(Fc1,'descend');
Fc = [Fc1 Fc2];
% % Select Variable amplitude
A1 = [1:64/Fs:9 3:96/Fs:15 5:24/Fs:8 2:16/Fs:4];
A2 = [2:48/Fs:8 4:24/Fs:7 1:32/Fs:5 3:24/Fs:6];
A = [A1 A2];
for i=1:length(t)
a_HZ = 2*pi*Fc(i)*t; % Set Frequency
sys(i) = A(i)*sin(a_HZ(i)); % FFT Output, A(i) Amplitude and a_HZ(i) is the changes in frequency
end
h = rand(1,4); % Random unknown system
r = filter(h,1,sys); % Input passed trought system(h)
y = awgn(r,30); % FFT Output Plus the random noise, white Gaussian noise to signal with SNR% Fourier Transformation
NFFT = Fs; % Next power of 2 from length of y
Y = fft(y,NFFT)/Fs;
fs= Fs/1;
[B,IX] = sort(2*abs(Y(1:NFFT))); %order the amplitudes
Amplitudes=(B) %find all amplitudes above the BFloor
Frequencies=Fc(IX) %frequency of the peaks

Best Answer

Hi,
As per my understanding , you want to all the frequcies available in the signal after it is being filtered out.
In the last but one line of your code "Amplitudes=(B) %find all amplitudes above the BFloor" , you haven't set any threshold for the amplitude.
Frequencies=Fc(B>BFloor)
This one line code would work for getting frequencies whose corresponding amplitudes greater than the threshold you set.
Refer "this" for better understanding.