


















Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!



















exp(1) ans = 2. sqrt(-16) ans = 0.0000 + 4.0000i a=cos(0.5) a = 0. b=cos(pi) b = - c=cos([pi 0.5*pi 0]) c = -1.0000 0.0000 1. c(2) ans = 6.1232e- c(1) ans =
c(2) ans = 6.1232e-
c(3) ans = 1 t=[2 3 4 5] t = 2 3 4 5 t(3) ans = 4 t(1) ans = 2 t(5) Index exceeds the number of array elements. Index must not exceed 4.
s=[1 -11 1 235 -314 -872 960] s = 1 -11 1 235 -314 -872 960 roots(s) ans =
-4.
-2.
r3=roots(s) r3 =
-4.
-2.
y=polyval(p,[-1 5 10]) y = 0 78 803 area1=(0.2/3)sum(y.[1 4 2 4 1]) Arrays have incompatible sizes for this operation. Related documentation y=[0.2 1.288 2.456 3.464 0.232] y = 0.2000 1.2880 2.4560 3.4640 0. area1=(0.2/3)sum(y.[1 4 2 4 1]) area1 =
x=[0 0.2 0.4 0.6 0.8] x = 0 0.2000 0.4000 0.6000 0. plot(x,y)
polyint(P) assumes a constant of integration K=0. Class support for inputs p, k: float: double, single See also polyder, polyval, polyvalm, polyfit. Documentation for polyint
area4=polyval(p2,0.8)-polyval(p2,0)
area4=polyval(p2,0.8)-polyval(p2,0) area4 =
area4=polyval(p2,0.8)-polyval(p2,0) area4 =
b=[0.5 0.237 0.46 0.61 0.63 0.7] b = 0.5000 0.2370 0.4600 0.6100 0.6300 0.
y_interp=interp1(x,y,b) y_interp = 2.9600 1.5041 2.7584 3.3024 2.9792 1. EJERCICIO 3 fun1=@(x) x.^3-2x.^2+ fun1 = function_handle with value: @(x)x.^3-2x.^2+ x1=-1.5:0.1: x1 = c=cos([pi 0.5pi 0]) c = -1.0000 0.0000 1. >> c(2) ans = 6.1232e- >> c(1) ans = - >> c(2) ans = 6.1232e- >> c(3) ans = 1 >> t=[2 3 4 5] t = 2 3 4 5 >> t(3) ans = 4 >> t(1) ans = 2 >> t(5) Index exceeds the number of array elements. Index must not exceed 4. >> s=[1 -11 1 235 -314 -872 960] s = 1 -11 1 235 -314 -872 960 >> roots(s) ans = 8. -4. 5. -2. 3. 1. >> r3=roots(s) r3 = 8. -4. 5. -2. 3. 1. >> y=polyval(p,[-1 5 10]) y = 0 78 803 >> area1=(0.2/3)sum(y.[1 4 2 4 1]) Arrays have incompatible sizes for this operation. Related documentation >> y=[0.2 1.288 2.456 3.464 0.232] y = 0.2000 1.2880 2.4560 3.4640 0. >> area1=(0.2/3)sum(y.[1 4 2 4 1]) area1 = 1. >> x=[0 0.2 0.4 0.6 0.8] x = 0 0.2000 0.4000 0.6000 0. >> plot(x,y) polyint(P) assumes a constant of integration K=0. Class support for inputs p, k: float: double, single See also polyder, polyval, polyvalm, polyfit. Documentation for polyint >> area4=polyval(p2,0.8)-polyval(p2,0) >> >> area4=polyval(p2,0.8)-polyval(p2,0) area4 = 1. >> area4=polyval(p2,0.8)-polyval(p2,0) area4 = 1. >> b=[0.5 0.237 0.46 0.61 0.63 0.7] b = 0.5000 0.2370 0.4600 0.6100 0.6300 0. >> y_interp=interp1(x,y,b) y_interp = 2.9600 1.5041 2.7584 3.3024 2.9792 1. EJERCICIO 3 >> fun1=@(x) x.^3-2x.^2+ fun1 = function_handle with value: @(x)x.^3-2*x.^2+ >> x1=-1.5:0.1: x1 = Columns 1 through 18 -1.5000 -1.4000 -1.3000 -1.2000 -1.1000 -1.0000 -0.9000 -0.8000 -0.7000 -0.6000 - 0.5000 -0.4000 -0.3000 -0.2000 -0.1000 0 0.1000 0.
t(3) ans = 4 >> t(1) ans = 2 >> t(5) Index exceeds the number of array elements. Index must not exceed 4. >> s=[1 -11 1 235 -314 -872 960] s = 1 -11 1 235 -314 -872 960 >> roots(s) ans = 8. -4. 5. -2. 3. 1. >> r3=roots(s) r3 = 8. -4. 5. -2. 3. 1. >> y=polyval(p,[-1 5 10]) y = 0 78 803 >> area1=(0.2/3)sum(y.[1 4 2 4 1]) Arrays have incompatible sizes for this operation. Related documentation >> y=[0.2 1.288 2.456 3.464 0.232] y = 0.2000 1.2880 2.4560 3.4640 0. >> area1=(0.2/3)sum(y.[1 4 2 4 1]) area1 = 1. >> x=[0 0.2 0.4 0.6 0.8] x = 0 0.2000 0.4000 0.6000 0. >> plot(x,y) polyint(P) assumes a constant of integration K=0. Class support for inputs p, k: float: double, single See also polyder, polyval, polyvalm, polyfit. Documentation for polyint >> area4=polyval(p2,0.8)-polyval(p2,0) >> >> area4=polyval(p2,0.8)-polyval(p2,0) area4 = 1. >> area4=polyval(p2,0.8)-polyval(p2,0) area4 = 1. >> b=[0.5 0.237 0.46 0.61 0.63 0.7] b = 0.5000 0.2370 0.4600 0.6100 0.6300 0. >> y_interp=interp1(x,y,b) y_interp = 2.9600 1.5041 2.7584 3.3024 2.9792 1. EJERCICIO 3 >> fun1=@(x) x.^3-2x.^2+ fun1 = function_handle with value: @(x)x.^3-2x.^2+ >> x1=-1.5:0.1: x1 = Columns 1 through 18 -1.5000 -1.4000 -1.3000 -1.2000 -1.1000 -1.0000 -0.9000 -0.8000 -0.7000 -0.6000 - 0.5000 -0.4000 -0.3000 -0.2000 -0.1000 0 0.1000 0. Columns 19 through 36 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 0.9000 1.0000 1.1000 1. 1.3000 1.4000 1.5000 1.6000 1.7000 1.8000 1.9000 2.
x2=-1:0.1: x2 = Columns 1 through 18 -1.0000 -0.9000 -0.8000 -0.7000 -0.6000 -0.5000 -0.4000 -0.3000 -0.2000 -0. 0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0. Columns 19 through 31 0.8000 0.9000 1.0000 1.1000 1.2000 1.3000 1.4000 1.5000 1.6000 1. 1.8000 1.9000 2. length(x2) ans = 31 y2=fun2(x2) y2 = Columns 1 through 18
area1=(0.2/3)sum(y.[1 4 2 4 1]) area1 = 1. >> x=[0 0.2 0.4 0.6 0.8] x = 0 0.2000 0.4000 0.6000 0. >> plot(x,y) polyint(P) assumes a constant of integration K=0. Class support for inputs p, k: float: double, single See also polyder, polyval, polyvalm, polyfit. Documentation for polyint >> area4=polyval(p2,0.8)-polyval(p2,0) >> >> area4=polyval(p2,0.8)-polyval(p2,0) area4 = 1. >> area4=polyval(p2,0.8)-polyval(p2,0) area4 = 1. >> b=[0.5 0.237 0.46 0.61 0.63 0.7] b = 0.5000 0.2370 0.4600 0.6100 0.6300 0. >> y_interp=interp1(x,y,b) y_interp = 2.9600 1.5041 2.7584 3.3024 2.9792 1. EJERCICIO 3 >> fun1=@(x) x.^3-2x.^2+ fun1 = function_handle with value: @(x)x.^3-2x.^2+ >> x1=-1.5:0.1: x1 = Columns 1 through 18 -1.5000 -1.4000 -1.3000 -1.2000 -1.1000 -1.0000 -0.9000 -0.8000 -0.7000 -0.6000 - 0.5000 -0.4000 -0.3000 -0.2000 -0.1000 0 0.1000 0. Columns 19 through 36 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 0.9000 1.0000 1.1000 1. 1.3000 1.4000 1.5000 1.6000 1.7000 1.8000 1.9000 2. >> x2=-1:0.1: x2 = Columns 1 through 18 -1.0000 -0.9000 -0.8000 -0.7000 -0.6000 -0.5000 -0.4000 -0.3000 -0.2000 -0. 0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0. Columns 19 through 31 0.8000 0.9000 1.0000 1.1000 1.2000 1.3000 1.4000 1.5000 1.6000 1. 1.8000 1.9000 2. >> length(x2) ans = 31 >> y2=fun2(x2) y2 = Columns 1 through 18 -5.1378 -5.0055 -4.8390 -4.6253 -4.3438 -3.9615 -3.4220 -2.6216 -1.3538 0. 5.1765 15.4706 45.8868 96.5000 47.4483 19.0000 11.6923 12. Columns 19 through 31
plot(x2,y2) grid area5=quad(fun2,0,1) area5 =
raiz1 = fzero(fun2,-1) raiz1 = -0. raiz2 = fzero(fun2,2) raiz2 =
y3=fun1(x2) y3 = Columns 1 through 18
sistema = @(x) [3.x(1)-cos(x(2).x(3))-0.5; x(1).^2-625x(2).^2;exp(-x(1).x(2))+20x(3)+(10pi- 3)/3] sistema = function_handle with value: @(x)[3.x(1)-cos(x(2).x(3))-0.5;x(1).^2-625x(2).^2;exp(-x(1).x(2))+20x(3)+(10pi-3)/3] x_inicial=[0; 0; 0] x_inicial = 0 0 0 solucion=fsolve(sistema,x_inicial) Equation solved.
x1=-1.5:0.1: x1 = Columns 1 through 18 -1.5000 -1.4000 -1.3000 -1.2000 -1.1000 -1.0000 -0.9000 -0.8000 -0.7000 -0.6000 - 0.5000 -0.4000 -0.3000 -0.2000 -0.1000 0 0.1000 0. Columns 19 through 36 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 0.9000 1.0000 1.1000 1. 1.3000 1.4000 1.5000 1.6000 1.7000 1.8000 1.9000 2. >> x2=-1:0.1: x2 = Columns 1 through 18 -1.0000 -0.9000 -0.8000 -0.7000 -0.6000 -0.5000 -0.4000 -0.3000 -0.2000 -0. 0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0. Columns 19 through 31 0.8000 0.9000 1.0000 1.1000 1.2000 1.3000 1.4000 1.5000 1.6000 1. 1.8000 1.9000 2. >> length(x2) ans = 31 >> y2=fun2(x2) y2 = Columns 1 through 18 -5.1378 -5.0055 -4.8390 -4.6253 -4.3438 -3.9615 -3.4220 -2.6216 -1.3538 0. 5.1765 15.4706 45.8868 96.5000 47.4483 19.0000 11.6923 12. Columns 19 through 31 >> plot(x2,y2) >> grid >> area5=quad(fun2,0,1) area5 = 29. >> raiz1 = fzero(fun2,-1) raiz1 = -0. >> raiz2 = fzero(fun2,2) raiz2 = 1. >> y3=fun1(x2) y3 = Columns 1 through 18 ### EJERCICIO 5 >> sistema = @(x) [3.x(1)-cos(x(2).x(3))-0.5; x(1).^2-625x(2).^2;exp(-x(1).x(2))+20x(3)+(10pi- 3)/3] sistema = function_handle with value: @(x)[3.x(1)-cos(x(2).x(3))-0.5;x(1).^2-625x(2).^2;exp(-x(1).x(2))+20x(3)+(10pi-3)/3] >> x_inicial=[0; 0; 0] x_inicial = 0 0 0 >> solucion=fsolve(sistema,x_inicial) Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
solucion =
valores = fsolve(sistema,x_inicial) Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
valores =
-0. EJERCICIO 7
ec1=@(x,y) 3.x+exp(x) ec1 = function_handle with value: length(x2) ans = 31 >> y2=fun2(x2) y2 = Columns 1 through 18 -5.1378 -5.0055 -4.8390 -4.6253 -4.3438 -3.9615 -3.4220 -2.6216 -1.3538 0. 5.1765 15.4706 45.8868 96.5000 47.4483 19.0000 11.6923 12. Columns 19 through 31 >> plot(x2,y2) >> grid >> area5=quad(fun2,0,1) area5 = 29. >> raiz1 = fzero(fun2,-1) raiz1 = -0. >> raiz2 = fzero(fun2,2) raiz2 = 1. >> y3=fun1(x2) y3 = Columns 1 through 18 ### EJERCICIO 5 >> sistema = @(x) [3.x(1)-cos(x(2).x(3))-0.5; x(1).^2-625x(2).^2;exp(-x(1).x(2))+20x(3)+(10pi- 3)/3] sistema = function_handle with value: @(x)[3.x(1)-cos(x(2).x(3))-0.5;x(1).^2-625x(2).^2;exp(-x(1).x(2))+20x(3)+(10pi-3)/3] >> x_inicial=[0; 0; 0] x_inicial = 0 0 0 >> solucion=fsolve(sistema,x_inicial) Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
solucion = >> valores = fsolve(sistema,x_inicial) Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient. x+exp(x) ec1 = function_handle with value: @(x,y)3.*x+exp(x)valores = 0. 0. -0. EJERCICIO 7 >> ec1=@(x,y) 3.
plot(Xs,Ys) x0 = [-1 1]
- -1 x0 = y0 = 1. - 1. y0 =
y0 = 1.