Вы находитесь на странице: 1из 52

MATRIX OPERATION

a=[1 2 3;4 5 6;7 9 8] %to create a simple matrix


a =

1 2 3
4 5 6
7 9 8

b= [1 2 4;4 5 6;3 8 1] %to create a simple matrix


b =

1 2 4
4 5 6
3 8 1

d=a+b%to add matrices


d =

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

F=c-d %to subtract matrix


F =

2 0 0
1 -10 -8
-8 -10 -5

G=c*d %to multiply matrices


G =

110 175 139


58 104 99
100 146 134
A=[5 9 0 4] %to create a simple row matrix
A =
5 9 0 4
B=[6;8;9;0] %to create a simple column matrix
B =

6
8
9
0
C=5*a-4*b %simple multiplication
C =

1 2 -1
4 5 6
23 13 36

det(G) %to find the determinant of matrix


ans =

4.6872e+04

a./b %to divide matrix component wise


ans =

1.0000 1.0000 0.7500


1.0000 1.0000 1.0000
2.3333 1.1250 8.0000

inv(C) %to find the inverse of matrix C


ans =

0.6667 -0.5556 0.1111


-0.0392 0.3856 -0.0654
-0.4118 0.2157 -0.0196

rand(4) %to create a random matrix of 4x4


ans =

0.8147 0.6324 0.9575 0.9572


0.9058 0.0975 0.9649 0.4854
0.1270 0.2785 0.1576 0.8003
0.9134 0.5469 0.9706 0.1419

a(3,3) %to find an element of 3nd row and 3rd column


ans =
8
ones(4) %to create matrix having all elements as 1 and of
order 4x4
ans =

1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1

zeros(4,2) %to create a matrix of order 4x2 and all elements


are zero
ans =

0 0
0 0
0 0
0 0
3*ones(2,3)
ans =

3 3 3
3 3 3

eye(4) %to create a identity matrix of order 4


ans =

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

f.^3 %to find the cube of the every element of matrix


ans =

8 8
125 27

f(2,2)=7 %to replace the element of 2nd row and 2nd


column
f =

2 2
5 7

g=[3 6;2 3]
g =

3 6
2 3

TO REDUCE A MATRIX
H=rand(6)
H =

0.4218 0.8491 0.6555 0.0971 0.4387 0.4456


0.9157 0.9340 0.1712 0.8235 0.3816 0.6463
0.7922 0.6787 0.7060 0.6948 0.7655 0.7094
0.9595 0.7577 0.0318 0.3171 0.7952 0.7547
0.6557 0.7431 0.2769 0.9502 0.1869 0.2760
0.0357 0.3922 0.0462 0.0344 0.4898 0.6797

A=H(:,3:5) %all row element and the element of column 3,4,5


A =

0.6555 0.0971 0.4387


0.1712 0.8235 0.3816
0.7060 0.6948 0.7655
0.0318 0.3171 0.7952
0.2769 0.9502 0.1869
0.0462 0.0344 0.4898

B=H([2 4],[1 3]) %elements of 2nd,4th, row and 1st,3rd,column


B =

0.9157 0.1712
0.9595 0.0318

C=H(4:6,1:3)
C =

0.9595 0.7577 0.0318


0.6557 0.7431 0.2769
0.0357 0.3922 0.0462

A([1 3 5],:)=[] %to delete particular rows and column


A =

0.1712 0.8235 0.3816


0.0318 0.3171 0.7952
0.0462 0.0344 0.4898
C(1,:)=[7] %to replace all enteries of 1st row by 7

C =

7.0000 7.0000 7.0000


0.6557 0.7431 0.2769
0.0357 0.3922 0.0462

MATRIX EXTENSION
A=rand(6) % to create a random matrix
A =

0.6551 0.5853 0.8909 0.8407 0.1966 0.5853


0.1626 0.2238 0.9593 0.2543 0.2511 0.5497
0.1190 0.7513 0.5472 0.8143 0.6160 0.9172
0.4984 0.2551 0.1386 0.2435 0.4733 0.2858
0.9597 0.5060 0.1493 0.9293 0.3517 0.7572
0.3404 0.6991 0.2575 0.3500 0.8308 0.7537

B=[4 5 3 1 9 5];

C=[A;B] % to add a row vector


C =

0.6551 0.5853 0.8909 0.8407 0.1966 0.5853


0.1626 0.2238 0.9593 0.2543 0.2511 0.5497
0.1190 0.7513 0.5472 0.8143 0.6160 0.9172
0.4984 0.2551 0.1386 0.2435 0.4733 0.2858
0.9597 0.5060 0.1493 0.9293 0.3517 0.7572
0.3404 0.6991 0.2575 0.3500 0.8308 0.7537
4.0000 5.0000 3.0000 1.0000 9.0000 5.0000

D=[1 3 5 7 9 6;0 2 3 7 5 5;];

E=[A;D] % to add a matrix D of 2x6


E =

0.6551 0.5853 0.8909 0.8407 0.1966 0.5853


0.1626 0.2238 0.9593 0.2543 0.2511 0.5497
0.1190 0.7513 0.5472 0.8143 0.6160 0.9172
0.4984 0.2551 0.1386 0.2435 0.4733 0.2858
0.9597 0.5060 0.1493 0.9293 0.3517 0.7572
0.3404 0.6991 0.2575 0.3500 0.8308 0.7537
1.0000 3.0000 5.0000 7.0000 9.0000 6.0000
0 2.0000 3.0000 7.0000 5.0000 5.0000

H=[3;4;5;7;8;9];

G=[A H] % to add the column matrix of order 6x1


G =

0.6551 0.5853 0.8909 0.8407 0.1966 0.5853 3.0000


0.1626 0.2238 0.9593 0.2543 0.2511 0.5497 4.0000
0.1190 0.7513 0.5472 0.8143 0.6160 0.9172 5.0000
0.4984 0.2551 0.1386 0.2435 0.4733 0.2858 7.0000
0.9597 0.5060 0.1493 0.9293 0.3517 0.7572 8.0000
0.3404 0.6991 0.2575 0.3500 0.8308 0.7537 9.0000

WORK WITH DAIGONAL ENTERIES

B=rand(7) % to create a random matrix


B =

0.3804 0.1299 0.3112 0.7482 0.5383 0.7749 0.4314


0.5678 0.5688 0.5285 0.4505 0.9961 0.8173 0.9106
0.0759 0.4694 0.1656 0.0838 0.0782 0.8687 0.1818
0.0540 0.0119 0.6020 0.2290 0.4427 0.0844 0.2638
0.5308 0.3371 0.2630 0.9133 0.1067 0.3998 0.1455
0.7792 0.1622 0.6541 0.1524 0.9619 0.2599 0.1361
0.9340 0.7943 0.6892 0.8258 0.0046 0.8001 0.8693
diag(B) %to display the diagonal enteries
ans =

0.3804
0.5688
0.1656
0.2290
0.1067
0.2599
0.8693

diag(B,2) %to display the 2nd upper diagonal


ans =

0.3112
0.4505
0.0782
0.0844
0.1455

diag(B,-2) % to get 2nd lower diagonal


ans =

0.1299 0.5285 0.0838 0.4427 0.3998 0.1361

diag(B,1)' % to get a transpose in row form


ans =

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

imag(a) % to write the imaginary part of a complex number


ans =
3

real(a)% to write a real part of a complex number


ans =

2
abs(a) % to find the absolute value of complex number
ans =

0.9828

angle(a) % to find the argument of a

>> ans =

3.605

GRAPH OF POLYNOMIAL OF DEGREE


FOUR AND IT’S DERIVATIVE
x=linspace(-20,20,500);
y=x.^4+2*x.^2-4*x
plot(y,'b+')
xlabel('x-axis')
ylabel('y-axis')
title('graph of x^4+2x^2-4x')
x=linspace(-20,20,500)
y=x.^4+2*x.^2-4*x
y1=diff(y)
plot(y1,'b+')
xlabel('x-axis')
ylabel('y-axis')
title('graph of y1')
x=linspace(-20,20,500)
y=x.^4+2*x.^2-4*x
y1=diff(y)
y2=diff(y1)
y3=diff(y2)
plot(y3,'b+')
xlabel('x-axis')
ylabel('y-axis')
title('graph of y3')
x=linspace(-20,20,500);
y=x.^4+5*x.^2-4*x;
y1=4*x.^3+10*x-1;
y2=12*x.^2+10;
y3=24*x;
plot(x,y,'r+',x,y1,'b+',x,y2,'m+',x,y3,'k+')
xlabel('x-axis')
ylabel('y-axis')
gtext('graph of y')
gtext('graph of y1')
gtext('graph of y2')
gtext('graph of y3')
GRAPH OF POLYNOMIAL OF DEGREE
THREE AND IT’S INTEGRAL
x=linspace(-10,10,500);
y=2*x.^3+4*x.^2;
plot(x,y,'r+');
xlabel('x-axis')
ylabel('y-axis')
legend('2x^3+4*x^2')
x=linspace(-10,10,500);
y=2*x.^3+4*x.^2;
y1=(x.^3.*(3*x + 20))/12
plot(x,y1,'r+')
xlabel('x-axis')
ylabel('y-axis')
legend('x^3(3x + 20)/12')
title('graph of y1')
x=linspace(-10,10,500);
y=2*x.^3+4*x.^2;
y1=(x.^3.*(3*x + 20))/12;
y2=(x.^4.*(3*x + 25))/60
plot(x,y2,'r+')
xlabel('x-axis')
ylabel('y-axis')
legend('y2 =(x^4(3x + 25))/60')
title('graph of y2')
syms x
x=linspace(-10,10,500)
y=x.^3+5*x.^2
y1=(x.^3.*(3*x + 20))/12
y2=(x.^4.*(3*x + 25))/60
plot(x,y,'r+',x,y1,'b+',x,y2,'k+')
xlabel('x-axis')
ylabel('y-axis')
gtext('y=x^3+5x^2')
gtext('y1=(x^3(3x + 20))/12')
gtext('y2=(x^4(3x + 25))/60')
GRAPH OF CIRCLE
t=linspace(-2*pi,2*pi,500);
r=3;
x=r*cos(t);
y=r*sin(t);
plot(x,y,'r-')
axis('equal')
xlabel('x-axis')
ylabel('y-axis')
gtext('x^2+y^2=9')
title('graph of circle')
t=linspace(-2*pi,2*pi,500);
r=3;
r1=4;
x=r*cos(t);
y=r*sin(t);
x1=r1*cos(t);
y1=r1*sin(t);
plot(x,y,'r-',x1,y1,'kd')
axis('equal')
xlabel('x-axis')
ylabel('y-axis')
gtext('x^2+y^2=9')
gtext('x1^2+y1^2=16')
title('graph of circles')
GRAPH OF PARABOLA
t=linspace(-20,20,500);
r=3;
x=r*t.^2;
y=2*r*t;
plot(x,y,'kd')
axis('equal')
xlabel('x-axis')
ylabel('y-axis')
gtext('y^2=12x')
title('graph of parabola')
t=linspace(-20,20,500);
r=3;
r1=3;
r2=8;
x=r*t.^2;
y=2*r*t;
x1=r1*t.^2;
y1=2*r1*t;
x2=r2*t.^2;
y2=2*r2*t;
plot(x,y,'kd',x1,y1,'md',x2,y2,'bd')
axis('equal')
xlabel('x-axis')
ylabel('y-axis')
gtext('y^2=12x')
gtext('y1^2=12x1')
gtext('y2^2=32x2')
title('graph of parabolas')
GRAPH OF ELLIPSE
When a>b
t=linspace(-20,20,500);

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

2. GRAPH OF cosh(x)AND acosh(x)


x=linspace(-10,10,300);
y=cosh(x);
subplot(1,2,1)
plot(x,y,'m+')
xlabel('x-axis')
ylabel('y-axis')
gtext('y=cosh(x)')
title('graph of cosh(x)')
grid on
y=acosh(x);
subplot(1,2,2)
plot(x,y,'m+')
xlabel('x-axis')
ylabel('y-axis')
gtext('y=acosh(x)')
title('graph of acosh(x)')
grid on

3. GRAPH OF tanh(x) AND atanh(x)


y=tanh(x);
subplot(1,2,1)
x=linspace(-1,1,100);
plot(x,y,'m+')
xlabel('x-axis')
ylabel('y-axis')
gtext('y=tanh(x)')
title('graph of tanh(x)')
grid on
y=atanh(x);
subplot(1,2,2)
plot(x,y,'m+')
xlabel('x-axis')
ylabel('y-axis')
gtext('y=atanh(x)')
title('graph of atanh(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

Вам также может понравиться