0% found this document useful (0 votes)
39 views

Exp-7 Plot

The document describes plotting 2D and 3D curves in MATLAB. It provides objectives, software used, numerical examples, syntax, commands, results and precautions. Examples include plotting a straight line, sine curve, cosine curve, cylinder and other 3D curves.

Uploaded by

Swaroop Mallick
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Exp-7 Plot

The document describes plotting 2D and 3D curves in MATLAB. It provides objectives, software used, numerical examples, syntax, commands, results and precautions. Examples include plotting a straight line, sine curve, cosine curve, cylinder and other 3D curves.

Uploaded by

Swaroop Mallick
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

UIT, ALLAHABAD DEPARTMENT OF ELECTRICAL ENGINEERING

EXPERIMENT NO-07

PLOTTING OF 2D AND 3D CURVES

1.1 Objective 1.2 Software Used 1.3 Numerical 1.4 Syntax 1.5 Command 1.6 Result 1.7 Precautions

1.1 OBJECTIVE: To plot the 2D and 3D curves.

1.2 SOFTWARE USED:

S.NO. SOFTWARE USED SPECIFICATION


1. MATLAB 7.9.0(R2009b)
2. MICROSOFT OFFICE WORD 2007

1.3 NUMERICAL. 1. Plot the 2D curves of given numerical.

i) St. line y = 2x + 3
ii) Sine curve y = sin x
iii) cosine curve y = cos x

2. Plot the 3D curve for given numerical.


iv) Cylinder y = 4cos t
v) x(t) = t, y(t) = t 2 , z(t) = t 2 0≤t≤1

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')

ii) Sine Curve:


>> x = 0:pi/100:4*pi;
>> y = sin(x);
>> plot(x,y);
>> xlabel('x');
>> ylabel('sinx');
>> title('sine curve')

Exp-7 (NEE-353) Page 14


UIT, ALLAHABAD DEPARTMENT OF ELECTRICAL ENGINEERING

iii) Cosine curve:


>> x = 0:pi/100:4*pi;
>> y = cos (x);
>> plot(x,y);
>> xlabel('x');
>> ylabel('cos x');
>> title('cosine curve')

iv) Cylinder:
>> t = 0:pi/100:pi*4;
>> [x,y,z]=cylinder(4*cos(t));
>> surf(x,y,z)
>> title(‘cylinder’)

v) x(t) = t, y(t) = t 2 , z(t) = t 2 0≤t≤1


>> t=linspace(0,1,100);
>> x=t;
>> y=t.^2;
>> z=t.^3;
>> plot3(x,y,z)
>> xlabel('x=t');
>> ylabel('y=t^2');
>> zlabel('z=t^3');
>> title('plot')

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

Exp-7 (NEE-353) Page 15


UIT, ALLAHABAD DEPARTMENT OF ELECTRICAL ENGINEERING

ii) Sine curve


sine curve
1

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

iii) Cosine curve


cosine curve
1

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

Exp-7 (NEE-353) Page 16


UIT, ALLAHABAD DEPARTMENT OF ELECTRICAL ENGINEERING

v) x(t) = t, y(t) = t 2 , z(t) = t 2 0≤t≤1

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:

 Command should be written correctly.


 Appropriate syntax should be used.

Exp-7 (NEE-353) Page 17

You might also like