You are on page 1of 11

EXPERIMENT 3-A

E-Example– 1
Date:17-11-2020

Question(Aim): Plotting of 3D parametric curve x  cos(t) , y  sin(t), z  sin(5t) using


comet3 and plot3
MATLAB command:
clear
clc
t=linspace(0,2*pi,500);
x=cos(t);
y=sin(t);
z=sin(5*t);
comet3(x,y,z);
plot3(x,y,z);
xlabel('x-axis');
ylabel('y-axis');
zlabel('z-axis');
title('3D Curve');

Input: code itself


Output:
E-Example– 2
Date: 17-11-2020

Question(Aim): Plot the helix defined by the parametric equations x  cost , y  sin t , z  t .
MATLAB command:
clear
clc
syms t
x=cos(t);
y=sin(t);
z=t;
ezplot3(x,y,z,[0,6*pi])

Input: code itself


Output:
E-Example– 3
Date: 17-11-2020

Question(Aim): plots the surface f(x,y)=e-x^2-y^2,  2  x, y  2


MATLAB command:
clear
clc
[x,y]=meshgrid(-2:.2:2);
f=x.*exp(-x.^2 - y.^2);
surf(x,y,f)

Input: code itself


Output:
E-Example– 4
Date: 17-11-2020

Question(Aim): The function z=xy2-x3 is to plotted in the interval 1 x, y 1


MATLAB command:
clear
clc
x=-1:.05:1;
y=-1:.05:1;
[x,y]=meshgrid(x,y);
z=x.*y.^2-x.^3
surf(x,y,z);
colormap spring
shading interp

Input: code itself


Output:
E-Example– 5
Date: 17-11-2020

Question(Aim): use ezsurf to plot the function f(x ,y )=2(x 2+y2)


MATLAB command:
clear
clc
syms x y
f=2*(x^2+y^2)
ezsurf(f)
colormap cool

Input: code itself


Output:
E-Example– 6
Date:17-11-2020

Question(Aim):Taylor series of the function 𝑓(𝑥, 𝑦) = 𝑒𝑥𝑐𝑜𝑠𝑦 is evaluated about the origin. Also the
function along with its Taylor series is plotted in the corresponding figure.

MATLAB command:
clear
clc
close all
syms x y
f=exp(x)*cos(y);
I=[0,0];
a=I(1);b=I(2);
n=5;
tayser=taylor(f,[x,y],[a,b],'order',n)
subplot(1,2,1);
ezsurf(f); %Function plot
subplot(1,2,2);
ezsurf(tayser);

Input: code itself


Output:
E-Record – 1
Date:17-11-2020

Question(Aim): Draw the surface of the function f(x,y)=e x+ey using ezsurf
MATLAB command:
clear
clc
syms x y
f=exp(x)*exp(y)
ezsurf(f)
colormap cool

Input: code itself


Output:
E-Record – 2
Date:17-11-2020

Question(Aim): Draw the 3-D plot for the function f(t)=(t, t 2, t 3), where 0  t  100
MATLAB command:
clear
clc
syms t
x=t;
x1=t^2;
x2=t^3;
ezplot3(x,x1,x2,[0,100])

Input: code itself


Output:
E-Record – 3
Date:17-11-2020

Question(Aim): Using ‘surf’ plot the surface f(x,y)=x(x2+y2)


MATLAB command:
clear
clc
x=-6:0.3:6;
y=-1:.05:1;
[x,y]=meshgrid(x,y);
z=x*(x^2+y^2)
surf(x,y,z);
colormap cool

Input: code itself


Output:
E-Record – 4
Date:17-11-2020

Question(Aim): To expand f (x, y)=ex ln(1+y) in terms of x and y upto the terms of 3 rd degree using
Taylor series.

MATLAB command:
clear
clc
close all
syms x y
f=exp(x)*log(1+y)
I=[0,0];
a=I(1);b=I(2);
n=3;
tayser=taylor(f,[x,y],[a,b],'order',n)
subplot(1,2,1);
ezsurf(f); %Function plot
subplot(1,2,2);
ezsurf(tayser);

Input: code itself


Output:
E-Record – 5
Date:17-11-2020

Question(Aim): Expand exyin Taylor series the neighbourhood of (1,1) .


MATLAB command:
clear
clc
close all
syms x y
f=exp(x*y)
I=[1,1];
a=I(1);b=I(2);
n=5;
tayser=taylor(f,[x,y],[a,b],'order',n)
subplot(1,2,1);
ezsurf(f); %Function plot
subplot(1,2,2);
ezsurf(tayser);

Input: code itself


Output:

You might also like