Question regarding signal sampling/reconstruction

Hello all, So I have this signal I need to plot in Matlab, and I have a few issues with creating the time line I guess. This is the code:
f_m1=400;
fm=10*f_m1;
fs=10*fm;
ts=1/fs;
t=0:ts:0.005;
%t=linspace(0,0.005,5000);
f1=400;
m_f=cos(2*pi*f_m1*t)+cos(20*pi*f_m1*t)-(f_m1/f1)*sin(2*pi*f_m1*t)-(10*f_m1/f1)*sin(20*pi*f_m1*t);
plot(t,m_f); grid on
xlabel('Time')
ylabel('m_f(t)')
title('m_f(t)')
You can see I used 2 ways to construct a time scale, one with a simple colon operator and one with linsapce
The nyquist freq for this signal should be 2*fm, and then using that i should be able to plot the signal correctly, but using that scale, im getting a very jagged function, with a smaller amplitude as well. Only at 3*fm im getting a correct amplitude, and only at around 10*fm im getting a smooth a function as using the linspace. Why is that?
Also, how do I know to convert the number of samples in the linsapce (this case being 5000) to a sampling frequency, and vice versa?
Thanks to any who help :)

답변 (1개)

Star Strider
Star Strider 2014년 12월 17일

0 개 추천

The Nyquist frequency is fn=fs/2, so by my calculations, with fs=10*fm, fn=5*fm.

댓글 수: 4

Moran
Moran 2014년 12월 17일
Wait...i may be mixing up terms after a very long day :P In order to correctly reconstruct(in this case plot) a signal, i need to use at lease twice the maximum freq. of the signal right?
In my case, the max freq. in my signal is fm=10*f_m1=10*400=4kHz, meaning i need at least fs=2*fm=8kHz right? but then whey only at about fs=10*fm do i get a decent plot?
The Nyquist frequency is the highest reliably resolvable frequency in a sampled signal. It is half the sampling frequency.
As I understand your Question and Comment, if the maximum frequency of your signal is 4KHz, you have to sample it at at least 8KHz in order to resolve the highest frequency in your signal. However, the Nyquist frequency remains half your sampling frequency, regardless of what it is. If you decide to sample it at 10KHz, the Nyquist frequency is then 5KHz even if there is nothing above 4KHz in your signal.
Moran
Moran 2014년 12월 18일
Ok I get it, so sorry for the mix up. But still, like you said 8KHz should be enough to properly sample and plot my signal, yet at at that frequency i dont get decent sampling at all, only at about 40KHz
It’s difficult for me to understand what you want to do in your code. It runs without error, and since I don’t know what it’s doing that you don’t want it to do (or not doing that you do), or what you intend your code to do, all I can do is address your concerns about the Nyquist frequency.
Note that ‘fs’ is 40KHz:
f_m1=400;
fm=10*f_m1;
fs=10*fm;
ts=1/fs;

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기

질문:

2014년 12월 17일

댓글:

2014년 12월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by