2016/10/24

Matlab: Draw a Sine curve with sind()

To plot a sine wave between 0° and 360° in Matlab, simply use sind() in degrees:

>> x = 0:360;
>> y = sind(x);
>> plot(x,y)

Result:



If you want to draw sine waves in radians, use sin() instead. The website below shows how to use the sin() function and how to adjust axis ranges:

Set axis limits and aspect ratio (MathWorks)

You may also try the code below:

>> s = [0:.1:2*pi];
>> y = sin(s);
>> plot(s,y)

Related Information:
How to draw a sine wave with Simulink

沒有留言:

張貼留言