Clear Filters
Clear Filters

How to generate a sine curve?

5 views (last 30 days)
Sarah on 26 Feb 2013
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*...
However, I keep getting an error. Can anyone help?
Sarah on 26 Feb 2013
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 on 26 Feb 2013
hi Sarah; you get one period because the time axis is not sampling with F=30Hz; beside you code does nt respect Nyquist condition

Sign in to comment.

Accepted Answer

Youssef  Khmou
Youssef Khmou on 26 Feb 2013
hi, try :
figure, plot(t,x)

More Answers (0)

Community Treasure Hunt

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

Start Hunting!