MATLAB WEEK-2


MATLAB

Plotting of curves and surfaces
Week: 2

METHOD 1



x=linspace(0,1,101)
plot(x,x.^3,'r+',x,sin(x),'b-',x,exp(x),'g.')




METHOD 2
using Hold on
clear all
x=linspace(0,1,101)
plot(x,x^3,'r*')
hold on
plot(x,sin(x),'g.')
hold on
plot (x,exp(x),'b+')



If we remove hold on, only last graph will be displayed.


METHOD 3
using subplot
x=0:.1:2*pi;
subplot(2,2,1);
plot (x,sin(x));
subplot(2,2,2);
plot(x,cos(x));
subplot(2,2,3);
plot(x,exp(-x));
subplot(2,2,4);
plot(x,sin(3*x));




Diffrentiation

syms x y
f=x^2+2*x*y+y*sin(x)
diff(f,x)
diff(f,y)

f =2*x*y + y*sin(x) + x^2
ans =
2*x + 2*y + y*cos(x)
ans =
2*x + sin(x)

Integration

syms x
f=x^3 + 3*x^2 + 5*x + 12
int(f,x,0,2)


f =
x^3 + 3*x^2 + 5*x + 12
ans =
46




Plotting graph
syms x
f=sin(2*x)+ cos(3*x)
ezplot(f)






3 Dimension graph
t=linspace(0,2*pi,500);
x=cos(t);
y=sin(t);
z=sin(5*t);
comet3(x,y,z)
plot3(x,y,z,'g*','markersize',7)
xlabel('x-axis')
ylabel('y-axis')
zlabel('z-axis')
title('3D Curve')





Comments

  1. casino【WG】online casino games online free
    【 MGM】online casino games online free 【 USA】on-line casino 10cric login games free 【 MGM】real money slots casino online slot games free chips no deposit free jeetwin 【 West 카지노

    ReplyDelete

Post a Comment

Popular posts from this blog

PRACTICE PROBLEM 8

Practice Problem 6-Isomorphic Numbers