Professional Documents
Culture Documents
f=
Inline function:
f(x) = 2*x+2
>> f
f=
Inline function:
f(x) = 2*x+2
>> fzero(f,0)
ans =
-1
Rta:la raz se encuentra en -1
b). 2 x2+2 = 0
f2 =
Inline function:
f2(x) = 2*x^2+2
Mtodos numricos Ing. Qumica e Ing. en Alimentos 2011
Ejercicios de Clculo de races
04-mayo-2017 villalba saul-acua sebastian
>> f2=inline('2.*x^2+2')
f2 =
Inline function:
f2(x) = 2.*x^2+2
>> ezplot('f2')
>> ezplot(f2)
>> fzero(f2,2)
Exiting fzero: aborting search for an interval containing a sign change
because NaN or Inf function value encountered during search.
(Function value at -1.21354e+154 is Inf.)
Check function or try again with a different starting value.
ans =
NaN
f3 =
Inline function:
f3(x) = x^3+x^2
>> fzero(f3,0)
ans =
>> ezplot(f3)
a). 2 x+2 = 0
roots([2,2])
ans =
-1
b). 2 x2+2 = 0
roots([2,0,2])
ans =
0.0000 + 1.0000i
0.0000 - 1.0000i
c). x3 + x2 = 0
roots([1,1,0,0])
ans =
0
0
-1
f=
Inline function:
f(x) = exp(-x^2)-cos(x)
>> ezplot(f),grid
>> x01=fzero(f,0)
x01 =
>> x02=fzero(f,1)
x02 =
1.4474
>> x03=fzero(f,2)
x03 =
1.4474
>> x04=fzero(f,3)
x04 =
1.4474
>> x05=fzero(f,4)
x05 =
4.7124
2 3 = 16
a) {
2 = 1
2 + 4 2 = 16
b) {
2 = 4
5 + = 3
c) {
+ + tan sin = 0
f=inline('[x(1)*x(2)-x(2)-2*x(1)^3+16;x(1)-x(2)^2+1]')
f=
Inline function:
f(x) = [x(1)*x(2)-x(2)-2*x(1)^3+16;x(1)-x(2)^2+1]
x0 =
1.0000 0.5000
>> fsolve(f,x0)
Equation solved.
ans =
2.0757 1.7538
b)
f=inline('[x(1)^2+4*x(2)^2-16;x(1)*x(2)^2-4]')
f=
Inline function:
f(x) = [x(1)^2+4*x(2)^2-16;x(1)*x(2)^2-4]
>> x0
x0 =
1.0000 0.5000
>> fsolve(f,x0)
Equation solved.
ans =
1.0784 1.9259
>> ezplot('x^2+4*y^2-16')
>> hold on
>> ezplot('x*y^2-4'), grid
>>
c)
>> f=inline('[exp(x(2))-x(1)^5+x(2)-3;x(1)+x(2)+tan(x(1))-sin(x(2))]')
f=
Inline function:
f(x) = [exp(x(2))-x(1)^5+x(2)-3;x(1)+x(2)+tan(x(1))-sin(x(2))]
>> x0
x0 =
1.0000 0.5000
>> fsolve(f,x0)
Equation solved.
ans =
-0.0401 0.7921
>> ezplot('exp(y)-x^5+y-3')
>> hold on
>> ezplot('x+y+tan(x)-sin(x)')
>> grid
>>