hello, I want to make the sine wave
when I execute below code at frequency 2, It is success.
but when I change the frequency to 10, It is not Sine wave..
What's wrong my code??
== correct ==
fs = 50;
t = 0:1/fs:1-1/fs;
x = sin(2*pi*2*t);
plot(t,x)
== non-correct
fs = 50;
t = 0:1/fs:1-1/fs;
x = sin(2*pi*10*t);
plot(t,x)

답변 (2개)

Torsten
Torsten 2022년 3월 17일

0 개 추천

fs = 500;
t = 0:1/fs:1-1/fs;
x = sin(2*pi*10*t);
plot(t,x)
Better ?

댓글 수: 1

제 허
제 허 2022년 3월 18일
Thank you for your answer
I think that frequency of sin(2*pi*10*t) is 10.
if I take the frequency more than 20 frequency for Nyquist Theory, Its perfectly reconstruct sine wave.
It's right??

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

Kevin Holly
Kevin Holly 2022년 3월 17일
편집: Kevin Holly 2022년 3월 17일

0 개 추천

== correct ==
fs = 50;
t = 0:1/fs:1-1/fs;
x = sin(2*pi*2*t);
plot(t,x)
== non-correct
fs = 50;
t = 0:1/fs:1-1/fs;
x = sin(2*pi*10*t);
plot(t,x)
Corrected
fs = 500;
t = 0:1/fs:1-1/fs; %Increase the sample rate
x = sin(2*pi*10*t);
plot(t,x)
Your sampling freqency needs to be twice the size of the highest frequency you are detecting. See Nyquist Theorem.

댓글 수: 6

Stephen23
Stephen23 2022년 3월 17일
"Your sampling freqency needs to be at least twice..."
제 허
제 허 2022년 3월 18일
Thank you for your answer.
I think that max frequency of sin(2*pi*10*t) is 10, then Its enough Fs = 20 for Nyquist Theorem.
It's right??
Kevin Holly
Kevin Holly 2022년 3월 18일
Correct.
제 허
제 허 2022년 3월 18일
Thank you for your answer
Then
fs = 50;
t = 0:1/fs:1-1/fs;
x = sin(2*pi*10*t);
plot(t,x)
In this code, The max frequency is 10, and sampling frequency is more than 5 times at 10
It satisfies the Nyquist Theory
but result of plot(t,x) is not like sine wave..
What's wrong??
Sorry about that, I missed the 2*pi.
subplot(2,1,1)
fs = 20;
t = 0:1/fs:1-1/fs;
x = sin(2*pi*10*t);
plot(t,x)
subplot(2,1,2)
fs = 2*pi*20;
t = 0:1/fs:1-1/fs;
x = sin(2*pi*10*t);
plot(t,x)
제 허
제 허 2022년 3월 18일
Sorry,,,,, I cant understand yet.
I dont know why Fs(sampling frequency) is multiplied by 2*pi ..
Thank you for your answer steadily

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

카테고리

태그

질문:

2022년 3월 17일

댓글:

2022년 3월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by