Professional Documents
Culture Documents
Matlab 2
Matlab 2
Matlab 2
Q2. Plot y=sin(x) where 0<=x<=2pi taking 100 linearly spaced points in a
given interval also label x and y axis and give the figure title as your
name.
Ans:
>> x = [0:pi/100:2*pi];
>> y = sin(x);
>> plot (x,y)
>> xlabel('x axis')
>> ylabel('y axis')
>> title('Sine curve')
5
Graph Plotting
Q3. For the figure of question 2 instead of plotting the line of curve show
6
Graph Plotting
>> x=[0:pi/100:4*pi];
>> y=(exp((-0.4)*x)).*(sin(x));
>> plot(y)
7
Graph Plotting
8
Graph Plotting
9
Graph Plotting
Q10.For question 1 write a program to draw a circle of arbitary radius 'r' using
script file.
Ans.
Create a new scipt aand type the following commands -
r=input('Enter the radius of circle:');
t=(0:pi/100:2*pi);
x=r*sin(t);
y=r*cos(t);
plot(x,y)
10
Graph Plotting
11