I want to generate a sine curve with a frequency of 1 Hz, amplitude of 0.2, and for a time of 15 seconds. I want the sampling rate to be 30 samples per second. This is something that I have so far:
Amp = 0.20;
Freq = 1;
Time.Val = [0:482-1];
Sig = Amp*...
sin(Freq*2*pi*Time.Val);
However, I keep getting an error. Can anyone help?

댓글 수: 4

Matt J
Matt J 2013년 2월 26일
편집: Matt J 2013년 2월 26일
You forgot to copy/paste your error messages for us, but it probably has to do with AMP.Mod.Time. You should show us how that's generated, too.
per isakson
per isakson 2013년 2월 26일
편집: per isakson 2013년 2월 26일
Whit does AMP.Mod.Time stand for? Is it defined?
Sarah
Sarah 2013년 2월 26일
Sorry everyone, AMP.Mod.Time should just be Time.Val. I am not actually getting an error, but my plot is weird, I am not getting 1 cycle per second, where each cycle has 30 samples.
Youssef  Khmou
Youssef Khmou 2013년 2월 26일
hi Sarah; you get one period because the time axis is not sampling with F=30Hz; beside you code does nt respect Nyquist condition

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

 채택된 답변

Youssef  Khmou
Youssef Khmou 2013년 2월 26일

0 개 추천

hi, try :
Fs=30;
t=0:1/Fs:15-1/Fs;
Amp=0.5;
F=1;
x=Amp*sin(2*pi*t*F);
figure, plot(t,x)

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Communications Toolbox에 대해 자세히 알아보기

질문:

2013년 2월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by