Thursday 13 December 2018

How to plot 2d graph in MATLAB ?

Steps :

     1. Define the range of  independent variable with number of divisions. 
    2. Define the function.
    3. Use the syntax to plot the graph. 


Syntax :

     plot(independent variable, function)

Example :
    Plot the graph of sin(x) from 0 to 2ℼ with 50 equal divisions of x.

    solution :
    
    step 1 : Define the variable x from 0 to 2ℼ with 50 equal divisions.
                  x=linspace(0,2*pi,50);

    step 2 : Define y=sinx
                  y=sin(x);

    step 3 : Use the syntax.
                  plot(x,y)





You can find detailed explanation from below video :

           

1 comment: