Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 35

Evaluación

UNIVERSIDAD PRIVADA DEL VALLE


FACULTAD DE INFORMATICA Y ELECTRONICA
INGENIERIA BIOMEDICA
CAMPUS TIQUIPAYA

METODOS NUMERICOS

Practica Nº1

Introducción
Grupo “A”

Estudiante: ROJAS LIMA CINTHIA


V.

Docente: Ing. Andrade Irahola


Mario
Cochabamba 26 de agosto del 2021

Gestión II – 2021
>> E=-(2-(1/3)*(3+(1/5)*(1+(1/2)))+2+(1/6))*3^4+(27)^(1/3)
E=
-245.4000
>> format bank; E
E=
-245.40

>> E=2-(1-(1/2)/1+(1/3+1/(1/4)))
E=
-2.83
>> format rat; E
E=
-17/6

>> E = sqrt(12)+5*sind(153)
E=
5.7341

a)
>> A=[-2 -2 5;1 7 -1]
A=
-2 -2 5
1 7 -1
b)
>> A(2,3)
ans =
-1

c)
>> A(2,3)=4
A=
-2 -2 5
1 7 4

d)
>> A(2,:)
ans =
1 7 4
e)
>> A(:,3)
ans =
5
4

f)
>> A(2,:)

ans =

1 7 -1

g)
>> B=sum(A(2,:))
B=
5
>> A = ones(2,2)

A=

1 1
1 1

>> B= zeros(3,2)

B=

0 0
0 0
0 0
>> v=[1 1 1 1]

v=

1 1 1 1

>> C = diag(v)

C=

1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
a)
>> C+F
ans =
6 5
-7 8

b)
>> 2*F - 4*C
ans =
0 -8
10 -14

c)
>> B*D
ans =
12 28 34
38 41 49
16 59 72

d)
>> FA=F'
FA =
4 -3
2 3

>> CA=C'
CA =
2 -4
3 5

>> FA*CA
ans =
-1 -31
13 7
e)
>> inv(F)
ans =
0.1667 -0.1111
0.1667 0.2222

f)
>> 2*C+F
ans =
8 8
-11 13

g)
>> F=[4 2; -3 3]

F=

4 2
-3 3

>> f=eig(F)

f=

3.5000 + 2.3979i
3.5000 - 2.3979i

h)
>> abs(E)
ans =
7 1 2
3 4 2
6 0 9

i)
>> C.*F
ans =
8 6
-8 5

j)
>> F.^C
ans =
16.0000 8.0000
0.0625 1.0000

k)
>> max(size(B))
ans =
3

l)
>> range(E)
ans =
4 4 7
m)
>> [L,U]=lu(G)
L=
0.3333 1.0000
1.0000 0
U=
3.0000 4.0000
0 -3.3333

n)
>> [Q,R]=qr(G)
Q=
-0.3162 -0.9487
-0.9487 0.3162
R=
-3.1623 -3.1623
0 3.1623
a)
v=[3, 6, 7, 8, 9, 4]
v=
3 6 7 8 9 4

b)
>> v(4)
ans =
8

c)
>> v(3:6)
ans =
7 8 9 4

d)
>> v(5)=[]
v=
3 6 7 8 4

>> x=-2:0.1:1;
f=exp(3*x)-3;
plot(x,f,'r'),xlabel('eje x'),title('Cinthia Rojas'),grid
>> ezplot('9*x.^2-y.^2-9',[-3;3]),grid,title('Ejercicio2.1')
>> ezplot('9*x.^2-y.^2-9',[-3,3,-4,4]),grid,title('Ejercicio2.2')

>> x=0.5:0.01:4;
>> x1=-3:0.01:4;
>> f=(x1+3)/2;
>> x2=-4:0.01:3;
>> g=abs(x2-1);
>> plot(x1,f,x2,g),grid, title('Grafico 1')
>> x1=-3:0.1:-1;
>> x2=-1:0.1:1;
>> x3=1:0.1:3;
>> f=(x1.^3+1).^(1/3);
>> g=1.5.*x2-1;
>> h=cos(x2);
>> plot(x1,f,x2,g,x3,h),xlabel('Eje X'),ylabel('Eje Y'),title('Gráfica función por trozos,
f(x)'),grid
Warning: Imaginary parts of complex X and/or Y arguments ignored
>> x=-3:0.1:3;
>> f=5*(nthroot(x,3)+2);
>> stairs(f),grid
a)
>> t=(-(pi/2):0.1:pi);
>> x=4*cos(t);
>> y=sin(t);
>> plot(x,y)

b)
>> t=-pi:0.1:10;
>> f=cos(t);
>> g=sin(t);
>> h=t;
>> plot3(f,g,h)
>> x=-4:0.1:4;
>> y=-4:0.1:4;
>> [X,Y]=meshgrid(x,y);
>> Z=X.^2-2*X.^2;
>> surf(X,Y,Z)
>> x=-2:0.1:2;
>> y=-2:0.1:3;
>> [X,Y]=meshgrid(x,y);
>> Z=(X-4*Y-2)/3;
>> mesh(X,Y,Z)

>> x=0:0.1:4;
>> f=(1/4)*log(x+1);
>> g=(1/4)*log(x+1);
>> subplot(1,2,1);
>> plot(x,f),title('Grafica 1'),grid
>> subplot(1,2,2);
>> plot(x,g),title('Grafica 2'),grid
>> syms x
>> F=factor(x^4-12*x)
F=
x*(x^3 - 12)
>> syms x
>> F=simplify(3/4-x)+(1/x)/(x+2)
F=
1/(x*(x + 2)) - x + ¾

>> x=3;
>> f=x*3+abs(x+2)+exp(2*x);
>> g=subs(f,x)

g=

7343484995420303/17592186044416

>> double(g)

ans =

417.4288
>> syms x
>> h=(1/36)*((3*x^5/5)+18*x^2+(4*exp(3*x)/3)+27*cos(x)-(1/3)*(cos(3*x)))
h=
exp(3*x)/27 - cos(3*x)/108 + (3*cos(x))/4 + x^2/2 + x^5/60
>> f=diff(diff(diff(h,x),x),x)
f=
exp(3*x) - sin(3*x)/4 + (3*sin(x))/4 + x^2
>> simplify(f)
ans =
exp(3*x) + sin(x)^3 + x^2
>> syms x
>> f(x)=(x^4+4*x+8)/(3*x-2);
>> f(2)
ans =
8

>> syms x
>> f= limit((1+x)^(1/x),x,0)
f=
exp(1)
>> format longE
>> eval(f)
ans =
2.718281828459046e+00

>> syms x y
>> f(x,y)=4*log(x)+3*y.^3+x*y+3*x;
>> f(3,2)
ans =
4*log(3) + 39

>> syms x
>> f=(cos(x)^2);
>> I=int(f)
I=
x/2 + sin(2*x)/4

>> syms x
>> f=x.^4-4*x.^2-3;
>> g=solve(f)
g=
(7^(1/2) + 2)^(1/2)
-(7^(1/2) + 2)^(1/2)
(2 - 7^(1/2))^(1/2)
-(2 - 7^(1/2))^(1/2)
>> pretty(g)
/ sqrt(sqrt(7) + 2) \
| |
| -sqrt(sqrt(7) + 2) |
| |
| sqrt(2 - sqrt(7)) |
| |
\ -sqrt(2 - sqrt(7)) /
>> syms x y
>> f=3*x-4*y==2;
>> g=4*x+2*y==7;
>> [Sx Sy]=solve(f,g)
Sx =
16/11
Sy =
13/22
>> syms x
>> f=sqrt(2*x+4)+5*x^3+3^x;
>> df(x)=diff(f,x)
df(x) =
3^x*log(3) + 15*x^2 + 2^(1/2)/(2*(x + 2)^(1/2))
>> df(2)
ans =
9*log(3) + 2^(1/2)/4 + 60

>> syms x y
>> f=x*y-5*x^3*y+3*y^2*x;
>> dfx=diff(diff(f,x),y)
dfx =
- 15*x^2 + 6*y + 1
>> syms x
>> f=4/(1+x^2);
>> I=int(f,0,1)
I=
pi
>> format long
>> eval(I)
ans =
3.141592653589793
function uno
n= input('Ingrese un numero mayor a 3: ');
m=1;
if n>3
for i=2:4:n;
m=m*i;
end
fprintf('El producto es: %0.4f\n',m)
else n<3
disp('El numero no es mayor a 3')
end
>> dos
Ingrese un numero mayor a 3: 20
El producto es: 30240.0000
function dos
x1= input('Ingrese x mínimo para f(x): ');
x2= input('Ingrese x máximo para f(x): ');
x=x1:0.1:x2;
n=input('Ingrese la función f(x): ');
y1= input('Ingrese x mínimo para g(y): ');
y2= input('Ingrese x máximo para g(y): ');
y=y1:0.1:y2;
m=input('Ingrese la función g(y): ');
subplot(2,1,1);
plot(x,n),grid, title('Grafica f(x)')
subplot(2,1,2);
plot(y,m),grid, title('Grafica g(y)')
end
>> dos
Ingrese x mínimo para f(x): -1
Ingrese x máximo para f(x): 2
Ingrese la función f(x): sqrt(x)+5*x.^2
Ingrese x mínimo para g(y): 0
Ingrese x máximo para g(y): 2*pi
Ingrese la función g(y): sin(3*y)

You might also like