Question regarding signal sampling/reconstruction
Show older comments
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 :)
Answers (1)
Star Strider
on 17 Dec 2014
0 votes
The Nyquist frequency is fn=fs/2, so by my calculations, with fs=10*fm, fn=5*fm.
4 Comments
Moran
on 17 Dec 2014
Star Strider
on 17 Dec 2014
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
on 18 Dec 2014
Star Strider
on 18 Dec 2014
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;
Categories
Find more on Spline Postprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!