fft showing frequency components at double rates
Mostrar comentarios más antiguos
Hi there
worked with Lumerical (photonic simulating software) i got a output Time domain-signal and wanted to see it's spectrum via fft , so i used fft but the plot is showing me components at double rate which lumerical moniter visualizing spectrum shows the right spectrum, so i wondered why it is, if you have an experince or such it would be great , and Here's my code for making this happen:
clear all
close all;
% rng('default')
% fs = 100; % sample frequency (Hz)
% t = 0:1/fs:10-1/fs; % 10 second span time vector
% y = (1.3)*sin(2*pi*15*t) ... % 15 Hz component
% + (1.7)*sin(2*pi*40*(t-2)) ... % 40 Hz component
% + 2.5*randn(size(t)); % Gaussian noise;
%
% figure(1)
% plot(t,y)
load TE0_time_signal.mat;
t=lum.x0;
y=lum.y0;
figure(1)
plot(t,y)
grid on
xlabel('Time in s')
ylabel('Output field Magnitude')
time_step=t(2);
fft_y = fft(y);
%
fs=1/time_step;
% [A,B,C,D] = butter(20,[192.668e+12 192.945e+12]/fs);
% d = designfilt('bandpassiir','FilterOrder',20, ...
% 'HalfPowerFrequency1',192.668e+12,'HalfPowerFrequency2',192.945e+12, ...
% 'SampleRate',fs);
n = length(y); % number of samples
f = (0:n-1)*(fs/n); % frequency range
power = abs(fft_y).^2/n; % power of the DFT
figure(2)
plot(f,power)
xlabel('Frequency')
ylabel('Power')
%
y0 = fftshift(fft_y); % shift y values
f0 = (-n/2:n/2-1)*(fs/n); % 0-centered frequency range
power0 = abs(y0).^2/n; % 0-centered power
figure(3)
plot(f0,power0)
xlabel('Frequency')
ylabel('Power')
as you can see plot worked and showed the frequency components for my output time-signal
at the top of script (comment lines) i added a sinus function to test this script and it works well and shows right components, i got this script from mathworks platform,
My script should show frequncy components at 192.806 THz , 193.431THz ,194.055 THz but shows these at 385.612 THz, 386.862 THz , 388.11 THz (around 0.3e+15 in plot)
can somebody tell me why is that? And How it can be solved right to get right plot?
i have a guess which may be relevent that Nyquist theorm for complex signals states that the fsampling is maximum frequency that you can show unambigiously which in real signals are fsampling/2
Thanks
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Spectral Analysis en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


