Exp-7 Plot
Exp-7 Plot
EXPERIMENT NO-07
1.1 Objective 1.2 Software Used 1.3 Numerical 1.4 Syntax 1.5 Command 1.6 Result 1.7 Precautions
i) St. line y = 2x + 3
ii) Sine curve y = sin x
iii) cosine curve y = cos x
1.4 SYNTAX:
i) For 2D curve
Plot (x,y)
ii) for 3D curve
t = linspace(range, interval)
plot3(x,y,z)
1.5 COMMAND:
i) St. line:
>> x = 0:0.02:3;
>> y = 2*x+3;
>> plot(x,y)
>> xlabel('x');
>> ylabel('y = 2x+3');
>> title('St.line')
iv) Cylinder:
>> t = 0:pi/100:pi*4;
>> [x,y,z]=cylinder(4*cos(t));
>> surf(x,y,z)
>> title(‘cylinder’)
1.6 RESULTS:
i) St.line
St.line
9
7
y = 2x+3
3
0 0.5 1 1.5 2 2.5 3
x
0.8
0.6
0.4
sinx 0.2
-0.2
-0.4
-0.6
-0.8
-1
0 2 4 6 8 10 12 14
x
0.8
0.6
0.4
0.2
cos x
-0.2
-0.4
-0.6
-0.8
-1
0 2 4 6 8 10 12 14
x
iv) Cylinder
0.8
0.6
0.4
0.2
0
4
2 4
0 2
0
-2 -2
-4 -4
plot
0.8
0.6
3
z=t
0.4
0.2
0
1
1
0.8
0.5 0.6
0.4
0.2
0 0
y=t2 x=t
1.7 PRECAUTION: