0% found this document useful (0 votes)
3K views18 pages

Clase 3

df

Uploaded by

Fredy Yenh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3K views18 pages

Clase 3

df

Uploaded by

Fredy Yenh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

>> a=[4 -1 1;4 -8 1;-2 1 5]

a=

-1

-8

-2

>> b=[7 -21 15]

b=

7 -21

15

>> %aplicamos traspuesta para resolver


>> b=b'

b=

7
-21
15

>> x=a\b

x=

2
4
3

>> x=inv(a)*b

x=

2.0000
4.0000
3.0000

>> %se esta encontando los valores de x=2 y=4 z=3


>> %para resolver ELIMINACION DE GAUS SE utiliza X=a\b
>> %para hallar matriz inversa se coloca x=inv(a)*a
>> %para hacer todo de lo anterior primeramente se realiza la traspuesta
>> x=rref([a,b])

x=

>> %para hallar el gauss jordan colocamos x=reff([a,b])


>> [x,y,z]=solve('4*x-y+z=7','4*x-8*y+z=-21','-2*x+y+5*z=15','x','y','z')

x=

y=

z=

>> %para hallar de la otra forma la ecuacion [x,y,z]=solve('4*xy+z=7','4*x-8*y+z=-21','-2*x+y+5*z=15','x','y','z')


>> %solve y linssolve
>> c=[-2 1 3;1 2 5;6 -3 -9]

c=

-2

-3

-9

>> d=[12 10 24]

d=

12

10

24

>> d=d'

d=

12
10
24

>> y=c\d
Warning: Matrix is singular to working precision.

y=

NaN
-Inf
Inf

>> y=inv(c)*d
Warning: Matrix is singular to working precision.

y=

Inf
Inf
Inf

>> y=rref([c,d])

y=

1.0000

0 -0.2000

1.0000

2.6000
0

0
0

1.0000

>> [x1,x2,x3]=solve('-2*x1+x2+3*x3=12','x1+2*x2+5*x3=10','6*x1-3*x29*x3=24','x','x2','x3')
Warning: Explicit solution could not be found.
> In solve at 179

x1 =

[ empty sym ]

x2 =

[]

x3 =

[]

>> e=[3 2 -5;-1 2 1;-2 1 1]

e=

-5

-1

-2

>> f=[0 -8 -7]

f=

-8

>> f=f'

f=

0
-8
-7

-7

>> z=e\f

z=

2.0000
-3.0000
0.0000

>> z=inv(e)*f

z=

2.0000
-3.0000
0.0000

>> z=rref([e,f])

z=

-3

>> [x1,x2,x3]=solve('3*x1+2*x2-5*x3=0','-1*x1+2*x2+1*x3=10','2*x1+1*x2+1*x3=24','x','x2','x3')
Warning: Explicit solution could not be found.
> In solve at 179

x1 =

[ empty sym ]

x2 =

[]

x3 =

[]

>> [x1,x2,x3]=solve('3*x1+2*x2-5*x3=0','-1*x1+2*x2+1*x3=-8','2*x1+1*x2+1*x3=-7','x','x2','x3')
Warning: Explicit solution could not be found.
> In solve at 179

x1 =

[ empty sym ]

x2 =

[]

x3 =

[]

>> [x,y]=meshgrid(-5:0.2:10);
>> z=(-2*x+y-12)/3;

>> surf(x,y,z)
>> old on
Undefined function 'old' for input arguments of type 'char'.

Did you mean:


>> hold on
>> z=(x+2*y-10)/5;
>> surf(x,y,z)
>> hold on
>> z=(6*x-3*y-24)/-9;
>> surf(x,y,z)
>> hold off
>> [x,y]=meshgrid(-5:0.5:10);
>> z=(3*x+2*y)/5;
>> hold on
>> z=(-x+2*y+8)
>> hold on
>> z=(-2*x+y+7)

>> char(64)

ans =

>> %es para colocar el arrova (convierte un codigo hace en caracter)


>> char(92)

ans =

>> char(91)

ans =

>> double('mario')

ans =

109

97 114 105 111

>> % el double sirve para convertir una cadena en codigo asi


>> double('MARIO')

ans =

77

65

82

73

79

>> lower('MARIOANGEL')

ans =

marioangel

>> % lower conviete una cadena de caracteres de mayuscula a menuscula


>> upper('juliaca')

ans =

JULIACA

>> %upper convierte una cadena de caracteres de minuscula a mayuscula


>> c2='hola'

c2 =

hola

>> strcmp(c1,c2)
Undefined function or variable 'c1'.

>> c2='HOLA'

c2 =

HOLA

>> strcmp(c1,c2)
Undefined function or variable 'c1'.

>> c1='HOLA'

c1 =

HOLA

>> strcmp(c1,c2)

ans =

>> % EL strcmp hace la igualdad


>> c3='MARIO'

c3 =

MARIO

>> c4='angel'

c4 =

angel

>> strcmpi(c3,c4)

ans =

>> c3='MARIooo'

c3 =

MARIooo

>> strcmpi(c3,c4)

ans =

>> % TRATAMIENTOS DE NUMEROS


>>
>> ceil(295.1234)

ans =

296

>> % ceil redondea al inmediato superior


>> fix(295.59)

ans =

295

>> % fix redondea al inmediato inferior


>> round(295.51)

ans =

296

>> % round hace el redondeo normal


>> rem(4,2)

ans =

>> % rem sirve para sacar el residuo


>> rem(5,1)

ans =

>> rem(25,7)

ans =

>> % rem sirve para sacar el rresto


>> % devolver el resto
>> mod(4,2)

ans =

>> % es lo mismo solo que no es de matlab


>>
>> rem(25,7)

ans =

>> j=char('flor','dina','maria','ruth')

j=

flor
dina

maria
ruth

>> e=[19 20 23 18]

e=

19

20

23

18

>> e=e'

e=

19
20
23
18

>> t=[j,e]

t=

flor
dina
maria
ruth

>> e=[19 20 23 18]

e=

19

20

23

18

>> j=char('flor','dina','maria','ruth')

j=

flor
dina
maria
ruth

>> e1=e1'
Undefined function or variable 'e1'.

>> j=char('flor','dina','maria','ruth')

j=

flor
dina
maria
ruth

>> e=[19 20 23 18]

e=

19

20

23

18

>> e=num2str(e)

e=

19 20 23 18

>> e=e'

e=

1
9

2
0

2
3

1
8

>> clear
>> j=char('flor','dina','maria','ruth')

j=

flor
dina
maria
ruth

>> e=[19 20 23 18]

e=

19

20

23

18

>> j=char('flor','dina','maria','ruth')

j=

flor
dina
maria
ruth

>> e=[1;2;3;4]

e=

1
2
3
4

>> e1=mun2str(e)
Undefined function 'mun2str' for input arguments of type 'double'.

>> e1=num2str(e)

e1 =

1
2

3
4

>> tablita=[j,e1]

tablita =

flor 1
dina 2
maria3
ruth 4

>>

You might also like