How to generate a sine curve?
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
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
2013-2-26
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 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!