You are on page 1of 9

PRACTICA Nº13

6 6 9 7

>> syms x y z w a
>> f=x^6 +y^6 +z^9 +w^7

f=
w^7 + x^6 + y^6 + z^9
>> subs(f,{x,y,z,w},{6,y,z,9*a+6})

ans =
(9*a + 6)^7 + y^6 + z^9 + 46656

PRACTICA Nº14
>> x=-9:0.6:9;
>> y=-9:0.6:9;
>> [x,y]=meshgrid(x,y);
>> z=x.*exp(-x.^9) -y.^6;
>> surf(x,y,z)
Warning: Axis limits outside float precision, use ZBuffer or Painters instead. Not rendering
Warning: Axis limits outside float precision, use ZBuffer or Painters instead. Not rendering

>> x=-9:0.6:9;
>> y=-9:0.6:9;
>> [x,y]=meshgrid(x,y);
>> z=x.*exp(-x.^9) -y.^7;
>> surf(x,y,z)
Warning: Axis limits outside float precision, use ZBuffer or Painters instead. Not rendering
Warning: Axis limits outside float precision, use ZBuffer or Painters instead. Not rendering

>> x=-9:0.6:9;
>> y=-9:0.6:9;
>> [x,y]=meshgrid(x,y);
>> z=x.*exp(-x.^6) -y.^6;
>> surf(x,y,z)
PRACTICA Nº15
>>r=6;

>>A=[r,2,3,4-r,5,r^2,5,0,4;r,3*r,4,5,r,3-r,r^3,3-r,0;0,0,4,5,6,7-r,r-5,r,5;r*2,r,r^2,2,4,6,7,r-
5,r+4;0,r,r,6,r-6,r,r+5,5,4;5,5,0,r,1,1,r^4,0,r/2;r,0,r,0,5,0,6,0,7;r/2,r,0,5,6,r^2,0,r*4,5;r-
12,r,5,r^5,r,r,0,0,1];

>>B=[2;5;7;4;12;6;8;9;3];

>>disp('el resultado de x es:')

>>x=A\B

>>det_A=det(A)
el resultado de x es:
x=
-0.7166
0.8092
-0.4181
-0.0004
-0.6078
-0.0340
-0.0011
-0.0661
2.5506

det_A =

-7.8396e+14

PRACTICA Nº16
>>p=[20.1,17.5,12,5,0,45.06,40.22,0.88,5,9,0.4,78,9.78,5.12,6,4,0,45.5,12.8,6.45,8.74,6.59,0.4
1,9.20,9,23.5,0,89];
>> x=6;
>> polyval(p,x)
ans =

2.3929e+22

>> x=-6:0.8:6;
>> y=polyval(p,x);
>> plot(x,y)

>> roots(p)

ans =

-1.2600 + 0.0000i
-1.0118 + 0.5133i
-1.0118 - 0.5133i
-0.9873 + 0.2233i
-0.9873 - 0.2233i
-0.4467 + 1.2038i
-0.4467 - 1.2038i
-0.8350 + 0.6167i
-0.8350 - 0.6167i
0.9685 + 0.1915i
0.9685 - 0.1915i
0.9551 + 0.4171i
0.9551 - 0.4171i
0.7812 + 0.8298i
0.7812 - 0.8298i
0.8605 + 0.6177i
0.8605 - 0.6177i
-0.5510 + 0.7888i
-0.5510 - 0.7888i
-0.2290 + 1.0336i
-0.2290 - 1.0336i
-0.0245 + 1.0310i
-0.0245 - 1.0310i
0.2160 + 0.9633i
0.2160 - 0.9633i
0.4986 + 0.8094i
0.4986 - 0.8094i

PRACTICA Nº17
R=6;L=9;
syms W H Y
W=2*sqrt(R^2 -(R-Y)^2)
S=L*W
V=int(S,Y,0,H)
VSCALE=[10:0.1:12]
for i=1:5
veq=V - VSCALE(i);
h_ans(i)=solve(veq);
end
h_scale=double(h_ans)

W=

2*(36 - (Y - 6)^2)^(1/2)

S=

18*(36 - (Y - 6)^2)^(1/2)

V=

162*pi + 324*asin(H/6 - 1) + 9*(36 - (H - 6)^2)^(1/2)*(H - 6)

VSCALE =

Columns 1 through 10

10.0000 10.1000 10.2000 10.3000 10.4000 10.5000 10.6000 10.7000 10.8000


10.9000

Columns 11 through 20

11.0000 11.1000 11.2000 11.3000 11.4000 11.5000 11.6000 11.7000 11.8000


11.9000
Column 21

12.0000

h_scale =

0.3893 + 0.0000i 0.3920 + 0.0000i 0.3946 + 0.0000i 0.3971 + 0.0000i 0.3997 + 0.0000i

PRACTICA Nº18
>> x=-9*pi:(3*pi)/90:6*pi;
>> y=sin(x);
>> plot(x,y,'r +')
>> hold on
>> y=cos(x);
>> plot(x,y,'b -.')
>> hold on
>> x1=-9*pi:(3*pi)/90:6*pi;
>> y1=tan(x1);
>> plot(x1,y1,'g *')
>> hold on
>> x2=-9*pi:(3*pi)/90:6*pi;
>> y2=sec(x2);
>> plot(x2,y2,'o -')
PRACTICA Nº19
clear C Xs Ys As
C=input('ingrese datos');
Xs=C(:,1)';
Ys=C(:,2)';
As=C(:,3)';
A=sum(As);
X=sum(As.*Xs)/A;
Y=sum(As.*Ys)/A;
fprintf('las cordenadas del centroide son:(%f,%f)',x,y);
>> practica19
ingrese
datos[1.439,11,9.817;5.378,5.378,19.635;5,11,35;5.378,16.622,19.635;11,1.439,9.817;11,5,35;
11,11,49;11,17,35;8.651,20.349,3.141;11,20.5,6;13.349,20.349,3.141;16.622,5.378,19.635;17,
11,35;16.622,16.622,19.635;20.561,11,9.817;-4.167,-9.833,17.5;-17.833,-9.833,17.5;-11,-
6.439,9.817]
las cordenadas del centroide son:(8.215471,8.519039)>>

PRACTICA Nº20
function fibonacci
n = input('Cuantos terminos de la serie quieres que te muestre? \n');
for i=1:n % Iniciamos un bucle
if i==1 || i==2 % Creamos una condición especial para los términos 1 y 2
number = 1;
else
number = get_term; % Llamamos la función
end
fprintf('%d ',number);
end
fprintf('\n');
clear all;
end

function nu = get_term % Definimos la función


persistent primero;
persistent segundo;
if isempty(primero)
primero = 1;
end
if isempty(segundo)
segundo = 1;
end
nu = primero + segundo;
primero = segundo;
segundo = nu;
end

>> fibonacci
¿Cuantos términos de la serie quieres que te muestre?
28
1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657
46368 75025 121393 196418 317811

You might also like