Vous êtes sur la page 1sur 29

TRABAJO N 01

Docente:
MSc. Betty Rimarachn Lpez
Asignatura:
MATLAB
Ciclo Acadmico:
V Ciclo 2014 I
Estudiantes:
Espino Pizarro, Cristian Miguel.
Ayasta Len, Renato.

Fecha de presentacin: 19/04/14

1)
b) A B

a) A+B

c) A.B

d)A+B

6 5
0
5
9
3
=(
8 7 5
5 7
6

e)A.B

4
1)
10
0

6 8 7 4
= (5 2 3 1)
4 9
2 0
7 1
6 3

Colocamos la informacin de las matrices en Comando Windows:


>> A=[6 -5 0 4; -5 9 3 1; 8 -7 5 10; -5 7 6 0]

A=

-5

-5

-7

10

-5

>> B=[6 -8 7 4; 5 -2 3 -1; 4 9 2 0; 7 1 6 -3]

B=

-8

-2

-1

-3

a) >> A+B

ans =

12 -13

12

10

12

-3

b) >> A-B

ans =

0
-10

-7

11

4 -16

10

-12

c) >> A.B = A*B

ans =

39 -34

51

34

4 -32

103
29

50

5 105
80

17

-2 -27

d) >> A+B'
ans =
12

11

-13

12

15

-4

16

-1

-3

e) >> A'*B'
ans =
112

69

-5 100

-123 -71

47 -89

35

37

15

86

48

45

89

2)
b) C.A.B

a) A.B +C
Donde:
4 2
0 6
= (1 7
5 6 )
9 0 11 3

7
5
=(
0
2

2
2
4
6

0
9)
1
4

7 1 5
= (5 1 8)
3
3 5

Colocamos la informacin de las matrices en Comando Windows:


>> A=[4 -2 0 6; 1 7 -5 6; 9 0 11 -3]
A=
4

-2

-5

11

-3

>> B=[7 2 0; -5 2 9; 0 4 -1; 2 6 4]


B=
7

-5

-1

>> C=[7 -1 5; -5 1 8; 3 3 5]
C=
7

-1

-5

a) >> A*B+C
ans =
57

39

11

-21

33 100

60

47 -18

b) >> C'*A*B
ans =
601 252 -487
105 124

17

407 676 651

4)
6 1
2
4 0
6
= 3 6 5
9 1 9
2 5
(0

3 6
1 8
8 5
8 3
9 10 )

5 1 8
= (2 4
0)
6 1 3
1
=( 0
9
4

2 7 9
= ( 6 5 10)
4 0 12

2
=( 1
3
8

2 3 4
8 2 8)
5 1 3
3 2 6

a)
>> A=[6 -1 2 3 6; -4 0 6 -1 8; 3 -6 5 8 -5; 9 -1 9 8 3; 0 2 -5 9 10]

A=
6

-1

-4

-1

-6

-5

-1

-5

10

>> format rat


>> inv(A)
ans =
369/3446

-217/3232

-423/13124

-611/2725

-235/5798

-79/1049

60/1049

-185/1844

-118/10227

123/3914

271/2780

292/6201

-65/15037

-33/226
-11/1049

123/5963

-206/6273

78/433

171/4285

83/1049

-31/1049

781/15230
-416/9761

125/1792
101/6983

6 9 6
5
8 4 )
9 2 7
6 4 10

b)
>> B=[5 -1 8; 2 4 0; 6 1 -3]

B=

-1

-3

>> det(B)
ans =
-242
>> format rat
>> inv(B)
ans =
6/121

-5/242

16/121

-3/121

63/242

-8/121

1/11

1/22

-1/11

c)
>> C=[-2 6 9 -6; 1 5 8 4; 3 9 -2 7; -8 6 4 10]

C=
-2 6 9 -6
1 5

8 4

3 9 -2 7
-8 6 4 10

>> det(C)
ans =
9906
>> format rat
>> inv(C)
ans =
-72/1651

168/1651

53/1651

376/4953

-109/1651

457/4953

73/9906

-11/4953

192/1651

-290/4953

-34/4953

-394/4953

123/1651

-31/4953

133/4953

d)
>> D=[-2 7 9; 6 5 10; 4 0 12]

D=

-2

10

12

>> det(D)
ans =
-524
>> format rat
>> inv(D)
ans =
-15/131

21/131

-25/524

8/131

15/131

-37/262

5/131

-7/131

13/131

-295/3302

e)
>> E=[1 2 3 4; 0 8 -2 8; 9 5 -1 3; -4 3 2 6]

E=
1

-2

-1

-4

>> det(E)
ans =
-70
>> format rat
>> inv(E)

ans =
-5/7

-1/2

4/7

6/7

122/35

11/5

-78/35

-29/7

76/35

11/10

-44/35

-16/7

-103/35

-9/5

67/35

25/7

5)
a)
2 5 + 4 = 7
+ 2 + 5 = 22
6 + 2 = 1
Expresamos en forma matricial los componentes de la ecuacin en MATLAB:

>> A=[2 -5 4; 1 2 5; 6 1 -2]


A=
2

-5

-2

>> B=[7; 32; -1]


B=
7
32
-1

>> C=A^(-1)*B
C=
1.0000
3.0000
5.0000

O tambin podramos obtener el resultado de la siguiente forma:


>> C=inv(A)*B
C=
1.0000
3.0000
5.0000
Obteniendo as que los valores son de x=1, y=3 y z=5, respectivamente.

b)
+ + + = 10
2 + 3 + + 5 = 24
3 + 2 + 3 = 2
4 + 3 4 + 2 = 6

Expresamos en forma matricial los componentes de la ecuacin en MATLAB:


>> A=[1 1 1 1; 2 3 1 5; 3 2 1 -3; 4 3 -4 2]
A=
1

-3

-4

>> B=[10; 24; 2; -6]


B=
10
24
2
-6

>> C=A^(-1)*B
C=
2.0000
-0.0000
5.0000
3.0000

O tambin podramos obtener el resultado de la siguiente forma:


>> C=inv(A)*B
C=
2.0000
-0.0000
5.0000
3.0000
Obteniendo as que los valores son de x=2, y=0, z=5 y w=3, respectivamente.

c)
3 + 6 + = 34
2 + 5 = 12
6 + 2 3 = 33

Expresamos en forma matricial los componentes de la ecuacin en MATLAB:


>> A= [3 6 1; 2 -1 5; 6 2 -3]
A=
3

-1

-3

>> B= [34; 12; 33]


B=
34
12
33

>> C=A^ (-1)*B


C=
5.0000
3.0000
1.0000

O tambin podramos obtener el resultado de la siguiente forma:


>> C=inv(A)*B
C=
5.0000
3.0000
1.0000
Obteniendo as que los valores son de x=5, y=3 y z=1, respectivamente.

6)

a)

Grafica de una funcion cubica


8

>> x=-2:0.01:2;
6

>> y=x.^3-x+1;

>> plot(x,y,'r','linewidth',2)

2
Eje y

>> grid on
>> xlabel('Eje x')

>> ylabel('Eje y')

-2

>> title('Grafica de una funcin


cubica')

-4

-6
-2

-1.5

-1

-0.5

0
Eje x

0.5

1.5

b)

Grafica de una funcion cuadratica


16

>> x=-1:0.008:2;

14
12

>> y=3*x.^4-4*x.^3;

10

>> grid on
>> xlabel('Eje x')

Eje y

>> plot(x,y,'--r','linewidth',3)

8
6
4
2

>> ylabel('Eje y')


>> title('Grafica de una funcion
cuadratica')

0
-2
-1

-0.5

0.5
Eje x

1.5

Grafica de una funcion cuadratica


3

c)

2.5

>> x=[0:pi/180:2*pi];
2

>> y=[2*sin(x)-cos(2*x)];

1.5
1

Eje y

>> plot(x,y,':p','linewidth',2)

0.5

>> grid on

>> xlabel('Eje x')


-0.5

>> ylabel('Eje y')

-1

>> title('Grafica de una funcion


cuadratica')

-1.5

Eje x

d)
Grafica de una funcion en valor absoluto
6

>> x=-3:0.02:3;
>> y=abs(3-x.^2);

>> plot(x,y,'-.k','linewidth',4)
Eje y

>> xlabel('Eje x')

>> ylabel('Eje y')


2

>> title('Grafica de una funcin en


valor absoluto')

>> grid on
0
-3

-2

-1

0
Eje x

Grafica de una funcion en valor absoluto

e)

10

>> y=3+abs(5-2.*x);

>> plot(x,y,':c','linewidth',3)

Eje y

>> x=[-1:0.007:4];

>> grid on

>> xlabel('Eje x')

>> ylabel('Eje y')

>> title('Grafica de una funcin en


valor absoluto')

3
-1

-0.5

0.5

1.5
Eje x

2.5

3.5

7)
a) () = 3 3 2 10, () = 2 + 2, [2,5; 3].
>> x=-2.5:0.01:3;
>> y=3*x.^3-x.^2-10*x;
>> z=-x.^2+2*x;
>> plot(x,y,':mx',x,z,'gx')
>> grid on

50
40
30
20
10
0
-10
-20
-30
-3

-2

-1

8
6

b) () = 1,
() = ( 1)3 , [1; 3].

4
2

>> x=-1:0.005:3;
>> y=x-1;
>> z=(x-1).^3;
>> plot(x,y,':xc',x,z,'gx')
>> grid on

0
-2
-4
-6
-8
-1

-0.5

0.5

1.5

2.5

14

c) () = 2 + 4 3,
() = 6 2,

() = 4 3, [0; 4].

12
10
8
6

>> x=0:0.008:4;
>> y=-x.^(2)+4*x-3;
>> z=6-2*x;
>> w=4*x-3;
>> plot(x,y,x,z,x,w)
>> grid on

4
2
0
-2
-4

0.5

1.5

2.5

3.5

50

d) () = 3 3 2 10,
() = 2 + 2, [2,5; 3]

40
30
20

>> x=-2.5:0.05:3;
>> y=3*x.^3-x.^2-10*x;
>> z=-x.^2+2*x;
>> plot(x,y,'r',x,z,'gx')
>> grid on

10
0
-10
-20
-30
-3

8)
Grafica de a) y b).
>> x=-10:0.5:10;
>> y=sqrt(25-x.^2);
>> plot(x,y)
>> z=fill(x,y,'g');
>> hold on
>> u=sqrt(9-(x-5).^2)+4;
>> plot(x,u)
>> w=fill(x,u,'b');
>> axis equal
>> grid on
>> xlabel('EJE X')
>> ylabel('EJE Y')

-2

-1

Grfica de c) y d).
>> x=-10:0.02:10;
>> y=sqrt(9-(9*x.^2)/25);
>> plot(x,y)
>> t=fill(x,y,'m');
>> hold on
>> w=sqrt((9-(9*(x-5).^2)/16))+6;
>> plot(x,w)
>> u=fill(x,w,'c')
>> hold off
>> axis equal
>> grid on

9)
a)
>> t=linspace(0, pi/100, 2*pi);
>> r=4-3*cos(t);
>> polar(t,r)

90

1.5

120

60
1

150

30
0.5

180

210

330

240

300
270

90

15

120

60
10

150

b)

30
5

>> t=linspace(0,2*pi);
>> r=6-6*sin(t);
>> polar(t,r)

180

210

330

240

300
270

90

120

60
2

150

30
1

c)
>> t=linspace(0,2*pi);
>> r=3*cos(5*t);
>> polar(t,r)

180

210

330

240

300
270

90

120

60
2

150

30
1

d)
>> t=linspace(0,2*pi);
>> r=3*sin(4*t);
>> polar(t,r)

180

210

330

240

300
270

10)

-2

-4

-6

-8

-10
-1

11)

3
2
1
0
-1
-2
-3
-4
-5

12)
>> x=[0 2 5 7 7 5 2 0];
>> y=[2 0 0 2 5 7 7 5];
>> plot(x,y)
>> fill(x,y,'m')
>> axis([-1 8 -1 8])
>> gtext('\bf\fontsize{20}OCTOGONO')
8
7
6
5

OCTOGONO

4
3
2
1
0
-1
-1

13)
>> x=linspace(-2,4,100);
>> y=(1/3)*x.^2+1;
>> plot(x,y,'r')
>> xentero=-2:4;
>> yentero=(1/3)*xentero.^2+1;
>> tangente=(2/3)*xentero.^2;
>> grid on
>> hold on
>> quiver(xentero,yentero,xentero,tangente,'b')
9
8
7
6
5
4
3
2
1
-3

-2

-1

14) Curvas Paramtricas:


Graficar las siguientes curvas paramtricas:
a) = 4( ),

= 4(1 ),

[0,6]

>> t=linspace(0,6*pi);
>> x=4*(t-sin(t));
>> y=4*(1->> cos(t));
>> plot(x,y)
>> grid on
8
7
6
5
4
3
2
1
0

10

20

30

40

50

60

70

80

b) Ecuacin de la Lemniscata en coordenadas paramtricas:


3
3
=
=
[0,2 ]
2
1 +
1 + 2
>> t=linspace(0,2*pi,5000);
>> x=(3*cos(t))./(1+(sin(t)).^2);
>> y=((3*sin(t)).*(cos(t)))./(1+(sin(t)).^2);
>> plot(x,y)
>> grid on
1.5

0.5

-0.5

-1

-1.5
-3

-2

-1

c)
>> t=linspace(0,2*pi,5000);
>> x=5*cos(t);
>> y=3*sin(t);
>> plot(x,y)
>> grid on
3

-1

-2

-3
-5

-4

-3

-2

-1

d)
>> y=3*sin(t);
>> z=2*t;
>> plot3(x,y,z,'--g','linewidth',4)
>> grid on

15

10

0
4
2

5
0

-2
-4

-5

15)
>> t=linspace(0,6*pi);
>> x=4*(t-sin(t));
>> y=4*(1-cos(t));
>> subplot(2,2,1)
>> plot(x,y)
>> grid on
>> xlabel('eje x')
>> ylabel('eje y')
>> title('Curva Paramtrica')
>> t=linspace(0,2*pi,5000);
>> x=(3*cos(t))./(1+(sin(t)).^2);
>> y=((3*sin(t)).*(cos(t)))./(1+(sin(t)).^2);
>> subplot(2,2,2)
>> plot(x,y)
>> grid on
>> xlabel('eje x')
>> ylabel('eje y')
>> title('Ecuacin de la Lemniscata')
>> t=linspace(0,2*pi,5000);
>> x=5*cos(t);
>> y=3*sin(t);
>> subplot(2,2,3)
>> plot(x,y)
>> grid on
>> xlabel('eje x')
>> ylabel('eje y')
>> title('Grafica de una funcion')
>> y=3*sin(t);
>> z=2*t;
>> subplot(2,2,4)
>> plot3(x,y,z,'--g','linewidth',4)
>> grid on
>> xlabel('eje x')
>> ylabel('eje y')
>> title('curva paramtrica en el espacio')
Ecuacin de la Lemniscata
2

eje y

eje y

Curva Paramtrica
8

4
2
0

0
-1

20

40
60
eje x
Grafica de una funcion

80

-2
-4

-2

0
2
4
eje x
curva paramtrica en el espacio

4
20

eje y

10

0
5

-2
-4
-5

0
0
eje x

eje y

-5 -5

0
eje x

16) Uso del mesh y del hold on:


Graficar en el mismo sistema de coordenadas en el espacio, el plano:
>> x=-2:0.15:2;
>> y=-2:0.15:2;
>> [X,Y]=meshgrid(x,y);
>> Z1=-X+Y;
>> mesh(X,Y,Z1,'FaceColor','blue');
>> hold on
>> Z2=2*X+Y-1;
>> mesh(X,Y,Z2,'FaceColor','red');
>> hold off

-5

-10
2
1

2
1

-1

-1
-2

-2

17)
>> x=-2:0.15:2;
>> y=-2:0.15:2;
>> [X,Y]=meshgrid(x,y);
>> Z1=-X+Y;
>> surf(X,Y,Z1,'FaceColor','blue');
>> hold on
>> Z2=2*X+Y-1;
>> surf(X,Y,Z2,'FaceColor','red');
>> hold off

-5

-10
2
1

2
1

-1

-1
-2

-2

18)
>> x=-10:0.5:10;
>> y=-10:0.5:10;
>> [X,Y]=meshgrid(x,y);
>> Z1=4-Y.^2;
>> mesh(X,Y,Z1,'FaceColor','yellow');
>> hold on
>> Z2=4-X.^2;
>> mesh(X,Y,Z2,'FaceColor','magenta');
>> hold off

20
0
-20
-40
-60
-80
-100
10
5

10
5

-5

-5
-10

-10

19)
>> x=-10:0.5:10;
>> y=-10:0.5:10;
>> [X,Y]=meshgrid(x,y);
>> Z1=4-Y.^2;
>> surf(X,Y,Z1,'FaceColor','yellow');
>> hold on
>> Z2=4-X.^2;
>> surf(X,Y,Z2,'FaceColor','magenta');
>> hold off

20
0
-20
-40
-60
-80
-100
10
5

10
5

-5

-5
-10

-10

20)
>> x=[-3*pi:0.5:3*pi];
>> y=[-3*pi:0.5:3*pi];
>> [X,Y]=meshgrid(x,y);
>> Z1=sin(sqrt(X.^2+Y.^2));
>> surf(X,Y,Z1);

0.5

-0.5

-1
10
5

10
5

-5

-5
-10

21)
>> x=[-3*pi:pi/800:3*pi];
>> y=[-3*pi:0.35:3*pi];
>> [X,Y]=meshgrid(x,y);
>> Z1=sin(sqrt(X.^2+Y.^2));
>> mesh(X,Y,Z1);

-10

22)
>> x=[-3*pi:0.35:3*pi];
>> y=[-3*pi:0.35:3*pi];
>> [X,Y]=meshgrid(x,y);
>> Z=sin(sqrt(X.^2+Y.^2));
>> surf(X,Y,Z)
>> axis([-3*pi 3*pi -3*pi 3*pi -2 2])
>> colormap bone

-1

-2
5
5

0
-5

23)
>> x=[-4:0.04:4];
>> y=[-4:0.04:4];
>> [X,Y]=meshgrid(x,y);
>> Z=exp(-X.^2)+exp(-Y.^2);
>> mesh(X,Y,Z);

0
-5

24)
>> x=[-4:0.05:4];
>> y=[-4:0.05:4];
>> [X,Y]=meshgrid(x,y);
>> Z=exp(-X.^2)+exp(-Y.^2);
>> mesh(X,Y,Z,'EdgeColor','red');

25)
a)
>> x=-4:0.1:4;
>> y=-4:0.1:4;
>> [X Y]=meshgrid(x,y);
>> Z=exp(-X.^2)+exp(-Y.^2);
>> mesh(X,Y,Z,'EdgeColor','r')
>> view(60,-15)

b)
>> x=-4:0.1:4;
>> y=-4:0.1:4;
>> [X Y]=meshgrid(x,y);
>> Z=exp(-X.^2)+exp(-Y.^2);
>> mesh(X,Y,Z,'EdgeColor','r')
>> axis off

26)
>> x=-5:0.1:5;
>> y=-5:0.1:5;
>> subplot(2,2,1)
>> ezsurf('x.^2+y.^2')
>> subplot(2,2,2)
>> ezsurf('x.^2+y.^2','circ')
>> subplot(2,2,3)
>> ezsurf('4-x.^2-y.^2')
>> subplot(2,2,4)
>> ezsurf('4-x.^2-y.^2','circ')

Vous aimerez peut-être aussi