Sampling frequency and correct signal plotting
71 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Berkay Yaldiz
el 18 de Sept. de 2021
Comentada: Berkay Yaldiz
el 20 de Sept. de 2021
Hi, I have been trying to understand effects of the sampling frequency to the time axis plots and it got me curious that why we have "corrupted" data points in the plotted figures although we have Fs > 2* (signal frequency). FFT results and plots are expected, but I could not understand the "corruption" in the time domain plots ( or the visual effect - it is not like a cosine anymore). Is there any mathematical reasons that 1kHz or 2kHz samping frequencies are not enough to visualize a cosine signal with 350 Hz. Here is my simple testing code:
L = 800;
Fs = [1e3 1.5e3 2e3 4e3 8e3 16e3 24e3];
for index=1:length(Fs)
Ts = 1/Fs(index);
x = (0:L-1)*Ts;
f = 350;
y = .5*cos(2*pi*f*x);
figure
plot(x(300:450),y(300:450))
title("Fs = " + string(Fs(index)))
end
0 comentarios
Respuesta aceptada
Star Strider
el 18 de Sept. de 2021
Editada: Star Strider
el 18 de Sept. de 2021
I believe this is simply an interaction of the sampling frequency and the signal frequency, typically referred to as ‘aliasing’.
I did the Fourier transforms to see if I could detect any irregularity, and the only finding was that the frequencies do not appear to be what they are intnded to be.
L = 800;
Fs = [1e3 1.5e3 2e3 4e3 8e3 16e3 24e3];
for index=1:length(Fs)
Ts = 1/Fs(index);
x = (0:L-1)*Ts;
f = 350;
y = .5*cos(2*pi*f*x);
figure
plot(x(300:450),y(300:450))
title("Fs = " + string(Fs(index)))
xc{index} = x;
yc{index} = y;
end
for index=1:length(Fs)
Fn = Fs(index)/2;
N = 2^nextpow2(numel(yc{index}));
FTy = fft(yc{index},N)/numel(yc{index});
Fv = linspace(0, 1, fix(N/2)+1)*Fn;
Iv = 1:numel(Fv);
figure
plot(Fv, abs(FTy(Iv))*2)
title("Fs = " + string(Fs(index)))
end
EDIT — (18 Sep 2021 at 17:44)
Changed:
FTy = fft(yc{index})/N;
to:
FTy = fft(yc{index},N)/numel(yc{index});
.
10 comentarios
Paul
el 19 de Sept. de 2021
Editada: Paul
el 19 de Sept. de 2021
That comment seemed to be talking about visualization in the frequency domain, because it referenced Fourier transform results and harmonics.
But it sounds like the real concern is how the signal is visualized in the time domain using Matlab's plot() command? If that's the case, the look of the plot is determined by how plot() fills in the space between the sample points that are input to the plot() command. Perhaps I still don't understand exactly what the desired or expected result is.
Más respuestas (0)
Ver también
Categorías
Más información sobre Matched Filter and Ambiguity Function en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!