# How would I plot a sin wave.

5 views (last 30 days)
Nicholas Deosaran on 17 Sep 2020
Answered: Sai Sri Pathuri on 22 Sep 2020
Hey all how would this be coded?
For a period of 10 seconds and an amplitude of 1 meter, develop a variable that consists of a sine wave of 2 periods where data are determined every tenth of a second.
i have an idea like this
t = [0:1/10:10];
y = 2*sin(t);
plot (t,a)
But I dont know if that is corrent
##### 2 CommentsShowHide 1 older comment
Asad (Mehrzad) Khoddam on 17 Sep 2020
For period of 10 seconds, f =1/10 or f=0.1 in the above equation.

Sign in to comment.

### Accepted Answer

Sai Sri Pathuri on 22 Sep 2020
Since you want to plot a sine wave of 2 periods in a time of 10 seconds, the time period of sine wave must be 5.
freq = 1/5;
sineWave = sin(2*pi*freq*t);
As amplitude required is 1, you need not multiply the sine wave with any coefficient. Hence, sineWave variable defined above is suffice. You can plot it as
plot(t,sineWave)
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Categories

Find more on Introduction to Installation and Licensing 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!

Translated by