Get spectrum. Fourier Transform
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello! I need to get Fourier spectrum. I think, I am close to the goal, but have some misunderstandings. Variable 'signal' contains the array of input data (50006 points), step of measure is 0.1, so I have a signal in physical space (signal(time)) and attempt to achieve the same in Fourier space (FourierTransform(frequency)).
Here is my try:
%%discretisation in physical space
step_time=0.1;
T=step_time*length(signal); % the whole time of measurements
time_=0.1:step_time:T; % according to Nyquist theorem
%%disret. in Fourier space
f_step=1/T;
F_duration = 1/step_time;
f_frequency = 0: f_step: F_duration;
f_frequency(end) = [];
%%get spectrum and get it normalized
Fourier_trans = fft(signal);
N_=length(Fourier_trans);
a=(Fourier_trans.*conj(Fourier_trans))/N_; % amplitude and normalization
but it goes wrong. What did I do incorrect..? Probably in last lines? Thank you in advance!
0 commentaires
Réponses (1)
Star Strider
le 14 Mar 2017
See if this works:
step_time=0.1;
sampling_frequency = 1/step_time;
nyquist_frequency = sampling_frequency/2;
%%get spectrum and get it normalized
Fourier_trans = fft(signal);
N_ = length(Fourier_trans);
a = abs(Fourier_trans)/N_; % amplitude and normalization
frequency_vector = linspace(0, 1, fix(N_/2)+1)*nyquist_frequency;
idx_vct = 1:length(frequency_vector);
figure(1)
plot(frequency_vector, a(idx_vct)*2)
grid
Note — This is UNTESTED CODE. It should work.
5 commentaires
Star Strider
le 15 Mar 2017
My pleasure.
This assignment:
a = (Fourier_trans.*conj(Fourier_trans))
calculates power (the square of amplitude), so you would have to divide by ‘N_^2’ to normalise it correctly.
Voir également
Catégories
En savoir plus sur Fourier Analysis and Filtering dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!