Академический Документы
Профессиональный Документы
Культура Документы
1 2 3
4 5 6
7 9 8
1 2 4
4 5 6
3 8 1
2 4 7
8 10 12
10 17 9
c=[4 4 7;9 0 4; 2 7 4] %matrix of 3x3
c =
4 4 7
9 0 4
2 7 4
2 0 0
1 -10 -8
-8 -10 -5
6
8
9
0
C=5*a-4*b %simple multiplication
C =
1 2 -1
4 5 6
23 13 36
4.6872e+04
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
0 0
0 0
0 0
0 0
3*ones(2,3)
ans =
3 3 3
3 3 3
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
f=[2 2;5 3]
f =
2 2
5 3
8 8
125 27
2 2
5 7
g=[3 6;2 3]
g =
3 6
2 3
TO REDUCE A MATRIX
H=rand(6)
H =
0.9157 0.1712
0.9595 0.0318
C=H(4:6,1:3)
C =
C =
MATRIX EXTENSION
A=rand(6) % to create a random matrix
A =
B=[4 5 3 1 9 5];
H=[3;4;5;7;8;9];
0.3804
0.5688
0.1656
0.2290
0.1067
0.2599
0.8693
0.3112
0.4505
0.0782
0.0844
0.1455
0.0759
0.0119
0.2630
0.1524
0.
COMPLEX NUMBER
a=complex(2,3) % to write a complex number
a =
2.0000 + 3.0000i
2
abs(a) % to find the absolute value of complex number
ans =
0.9828
>> ans =
3.605
a=5;
b=4;x=a*sin(t);
y=b*cos(t);
plot(x,y,'bd')
axis('equal')
xlabel('x-axis')
ylabel('y-axis')
gtext('x^2/25+y^2/16=1')
title('graph of ellipse')
When a<b
t=linspace(-20,20,500);
a=5;
b=4;
x=b*sin(t);
y=a*cos(t);
plot(x,y,'bd')
axis('equal')
xlabel('x-axis')
ylabel('y-axis')
gtext('x^2/16+y^2/25=1')
title('graph of verticle ellipse')
t=linspace(-20,20,500);
a=5;
a1=9;
a2=16;
b=4;
x=a*sin(t);
y=b*cos(t);
x1=a1*sin(t);
y=b*cos(t);
x2=a2*sin(t);
y=b*cos(t);
plot(x,y,'bd',x1,y,'m+',x2,y,'k*')
axis('equal')
xlabel('x-axis')
ylabel('y-axis')
gtext('x^2/25+y^2/16=1')
gtext('x^2/81+y^2/16=1')
gtext('x^2/256+y^2/16=1')
title('graph showing variation in a ')
t=linspace(-20,20,500);
b=3;
b1=9;
b2=16;
a=5;
x=a*sin(t);
y=b*cos(t);
x=a*sin(t);
y1=b1*cos(t);
x=a*sin(t);
y2=b2*cos(t);
plot(x,y,'bd',x,y1,'m+',x,y2,'k*')
axis('equal')
xlabel('x-axis')
ylabel('y-axis')
gtext('y^2/9+x^2/25=1')
gtext('y1^2/81+x^2/9=1')
gtext('y2^2/256+x^2/9=1')
title('graph showing variation in b ')
GRAPH OF HYPERBOLA
t=linspace(-2*pi,2*pi,1000);
a=3;
b=4;
x=a*sec(t);
y=b*tan(t);
plot(x,y,'m+')
axis('equal')
xlabel('x-axis')
ylabel('y-axis')
legend('x^2/9-y^2/16=1')
title('graph of hyperbola')
t=linspace(-2*pi,2*pi,1000);
a=3;
a1=7;
a2=9;
b=4;
x=a*sec(t);
y=b*tan(t);
x1=a1*sec(t);
y=b*tan(t);
x2=a2*sec(t);
y=b*tan(t);
plot(x,y,'m+',x1,y,'k+',x2,y,'b+')
axis('equal')
xlabel('x-axis')
ylabel('y-axis')
legend('x^2/16-y^2/9=1','x1^2/49-y^2/9=1','x2^2/81-y^2/9=1')
title('graph of hyperbolas')
CONJUGATE HYPERBOLA
t=linspace(-2*pi,2*pi,1000);
a=3;
b=4;
y=a*sec(t);
x=b*tan(t);
plot(x,y,'m+')
axis('equal')
xlabel('x-axis')
ylabel('y-axis')
legend('y^2/9-x^2/16=1')
title('graph of hyperbola')
t=linspace(-2*pi,2*pi,1000);
a=3;
a1=7;
a2=9;
b=4;
y=a*sec(t);
x=b*tan(t);
y1=a1*sec(t);
x=b*tan(t);
y2=a2*sec(t);
x=b*tan(t);
plot(x,y,'m+',x,y1,'k+',x,y2,'b+')
axis('equal')
xlabel('x-axis')
ylabel('y-axis')
legend('y^2/9-x^2/16=1','y1^2/49-x^2/16=1','y2^2/81-x^2/16=1')
title('graph of hyperbolas')
GRAPHS OF FUNCTIONS
1. exp(ax+b)
x=linspace(-10,10,1000);
y=exp(x);
plot(x,y,'k+')
xlabel('x-axis')
ylabel('y-axis')
legend('y=exp(x)')
title('graph of y=exp(x)')
x=linspace(-1,1,1000);
a=5;
b=11;
y=exp(a*x+b);
plot(x,y,'b+')
xlabel('x-axis')
ylabel('y-axis')
legend('y=exp(5x+11)')
title('graph of y=exp(ax+b)')
x=linspace(-1,1,500);
a=5;
b=11;
y=exp(x);
y1=exp(a*x+b);
plot(x,y,'k+',x,y1,'b+')
xlabel('x-axis')
ylabel('y-axis')
legend('y=exp(x)','y1=exp(5x+11)')
title('graph of y=exp(x)and y1=exp(ax+b)')
2. log(ax+b)
x=linspace(0,5,500);
a=1;
b=2;
y=log(a*x+b);
plot(x,y,'k+')
xlabel('x-axis')
ylabel('y-axis')
legend('y=log(x+2)')
title('graph of y=log(ax+b)')
x=linspace(0,5,500);
a=8;
b=10;
y=log(a*x+b);
plot(x,y,'k+')
xlabel('x-axis')
ylabel('y-axis')
legend('y=log(8x+10)')
title('graph of y=log(ax+b)')
x=linspace(-1,4,500);
a=1;
b=2;
a1=8;
b1=10;
y=log(a*x+b);
y1=log(a1*x+b1);
plot(x,y,'k+',x,y1,'b+')
xlabel('x-axis')
ylabel('y-axis')
legend('y=log(x)','y1=log(a1*x+b1)')
title('graph of y=log(ax+b) and y1=log(a1*x+b1)')
3. GRAPH OF sin(ax+b)
x=linspace(-2*pi,2*pi,2000);
a=3;
b=9;
y=sin(a*x+b);
plot(x,y,'r*')
xlabel('x-axis')
ylabel('y-axis')
legend('y=sin(4x+8)')
title('graph of sin(ax+b)')
x=linspace(-2*pi,2*pi,2000);
a=7;
b=8;
y=sin(a*x+b);
plot(x,y,'k*')
xlabel('x-axis')
ylabel('y-axis')
legend('y=sin(7x+8)')
title('graph of sin(ax+b)')
x=linspace(-2*pi,2*pi,2000);
a=11;
b=5;
b1=12;
y=sin(a*x+b);
y1=sin(a*x+b1);
plot(x,y,'r*',x,y1,'k*')
xlabel('x-axis')
ylabel('y-axis')
legend('y=sin(11x+5)','y1=sin(4x+12)')
title('graph of variation in b')
x=linspace(-2*pi,2*pi,1000);
a=2;
b=9;
a1=12;
y=sin(a*x+b);
y1=sin(a1*x+b);
plot(x,y,'r*',x,y1,'k*')
xlabel('x-axis')
ylabel('y-axis')
legend('y=sin(2x+9)','y1=sin(12x+8)')
title('graph of variation in a')
4. GRAPH OF cos(ax+b)
x=linspace(-2*pi,2*pi,2000);
a=3;
b=6;
y=cos(a*x+b);
plot(x,y,'r*')
xlabel('x-axis')
ylabel('y-axis')
legend('y=COS(4x+8)')
title('graph of COS(ax+b)')
x=linspace(-2*pi,2*pi,2000);
a=5;
b=4;
b1=10;
y=cos(a*x+b);
y1=cos(a*x+b1);
plot(x,y,'r*',x,y1,'k*')
xlabel('x-axis')
ylabel('y-axis')
legend('y=cos(5x+4)','y1=cos(4x+10)')
title('graph of variation in b')
x=linspace(-2*pi,2*pi,2000);
a=7;
b=9;
a1=12;
y=cos(a*x+b);
y1=cos(a1*x+b);
plot(x,y,'r*',x,y1,'k*')
xlabel('x-axis')
ylabel('y-axis')
legend('y=cos(7x+9)','y1=cos(12x+8)')
title('graph of variation in a')
SUBPLOTTING OF GRAPH
t=linspace(-10,10,100);
a=5;
x=a*t.^2;
y=2*a*t;
subplot(2,2,1)
plot(x,y,'r*')
xlabel('x-axis')
ylabel('y-axis')
title('graph of y^2=4ax')
x=-a*t.^2;
y=2*a*t;
subplot(2,2,2)
plot(x,y,'r*')
xlabel('x-axis')
ylabel('y-axis')
title('graph of y^2=-4ax')
y=a*t.^2;
x=2*a*t;
subplot(2,2,3)
plot(x,y,'r*')
xlabel('x-axis')
ylabel('y-axis')
title('graph of x^2=4ay')
y=-a*t.^2;
x=2*a*t;
subplot(2,2,4)
plot(x,y,'r*')
xlabel('x-axis')
ylabel('y-axis')
title('graph of x^2=-4ay')
t=linspace(-12,13,200);
a=8;
b=11;
x=a*cos(t);
y=b*sin(t);
subplot(2,2,1)
plot(x,y,'k*')
axis('equal')
xlabel('x-axis')
ylabel('y-axis')
gtext('x^2/64+y^2/121=1')
title('graph of horizontal ellipse')
x=b*cos(t);
y=a*sin(t);
subplot(2,2,2)
plot(x,y,'k*')
axis('equal')
xlabel('x-axis')
ylabel('y-axis')
gtext('x^2/64+y^2/121=1')
title('graph of verticle ellipse')
x=a*sec(t);
y=b*tan(t);
subplot(2,2,3)
plot(x,y,'b*')
axis('equal')
xlabel('x-axis')
ylabel('y-axis')
legend('x^2/64-y^2/121=1')
title('graph of hyperbola')
y=a*sec(t);
x=b*tan(t);
subplot(2,2,4)
plot(x,y,'b*')
axis('equal')
xlabel('x-axis')
ylabel('y-axis')
legend('y^2/64-x^2/121=1')
title('graph of conjugate hyperbola')
HYPERBOLIC FUNCTION
1.GRAPH OF sinh(x)AND asinh(x)
x=linspace(-10,10,100);
y=sinh(x);
subplot(1,2,1)
plot(x,y,'m+')
xlabel('x-axis')
ylabel('y-axis')
gtext('y=sinh(x)')
title('graph of sinh(x)')
grid on
y=asinh(x);
subplot(1,2,2)
plot(x,y,'m+')
xlabel('x-axis')
ylabel('y-axis')
gtext('y=asinh(x)')
title('graph of asinh(x)')
grid on
3D PLOTTING
x=linspace(-5,5,100);
y=x.^2;
[X,Y]=meshgrid(x,y);
z=X.^2+Y.^2;
subplot(2,2,1)
mesh(X,Y,z)
x=linspace(-5,5,100);
y=x.^2;
[X,Y]=meshgrid(x,y);
z=X.^2+Y.^2;
subplot(2,2,2)
meshc(X,Y,z)
x=linspace(-5,5,100);
y=x.^2;
[X,Y]=meshgrid(x,y);
z=X.^2+Y.^2;
subplot(2,2,3)
meshz(X,Y,z)
x=linspace(-5,5,100);
y=x.^2;
[X,Y]=meshgrid(x,y);
z=X.^2+Y.^2;
subplot(2,2,4)
plot3(X,Y,z)
x=linspace(-5,5,100);
y=x.^3;
[X,Y]=meshgrid(x,y);
z=X.^2+Y.^2;
subplot(2,2,1)
mesh(X,Y,z)
colorbar
x=linspace(-5,5,100);
y=x.^3;
[X,Y]=meshgrid(x,y);
z=X.^2+Y.^2;
subplot(2,2,2)
meshc(X,Y,z)
colorbar
x=linspace(-5,5,100);
y=x.^3;
[X,Y]=meshgrid(x,y);
z=X.^2+Y.^2;
subplot(2,2,3)
meshz(X,Y,z)
colormap
x=linspace(-5,5,100);
y=x.^3;
[X,Y]=meshgrid(x,y);
z=X.^2+Y.^2;
subplot(2,2,4)
plot3(X,Y,z)
colormap
z=X.^2+Y.^2;
subplot(2,2,1)
contour(X,Y,z)
colorbar
x=linspace(-5,5,100);
y=x.^4;
[X,Y]=meshgrid(x,y);
z=X.^2+Y.^2;
subplot(2,2,2)
contour(X,Y,z)
colorbar
x=linspace(-5,5,100);
y=x.^4;
[X,Y]=meshgrid(x,y);
z=X.^2+Y.^2;
subplot(2,2,3)
contour(X,Y,z)
colormap
x=linspace(-5,5,100);
y=x.^4;
[X,Y]=meshgrid(x,y);
z=X.^2+Y.^2;
subplot(2,2,4)
contour(X,Y,z)
colormap