Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
QU ES?
CMO ES?
QU HACE?
Variables:
Cdigo:
a = ((4.1).^((0.2+1)/2))/((2.^(0.5))/3-(0.4)/(3.^(1/3)))
A= [3,4;45,65;546,65.65]
b=5.32
Manual
Corrida de Carpeta
INFORME DE LABORATORIO N2
Fecha : 25/08/2016
Qu es?
Cmo es?
Qu hace?
Variables
Cdigo
a1=3
b1=7
c1= a1*b1
d1= a1\b1
d2= a1/b1
x= -5:.2:8; % el dominio
y= sin(x); % el rango
y= sign(1+sign(1-x))
y= log(x).*sign(sign(x-.01)+1); % el rango
plot(x,y)
hold on
y=log10(x).*sign(sign(x-.01)+1); % el rango
plot(x,y)
y= log2(x).*sign(sign(x-.01)+1); % el rango
hold off
ezplot('exp(-x.^2-3*x+1)-x/5-1',[-9,9])
Manual:
Corrida de Carpeta
INFORME DE LABORATORIO N3
QU ES?
CMO ES?
QU HACE?
Variables:
f : funcion ya definida
Cdigo:
s22=input('f(x)=')
x=-5:0.5:3
f=inline(s22)
Manual
Corrida de Carpeta
INFORME DE LABORATORIO N4
Fecha : 06/09/2016
Qu es?
Cmo es?
Qu hace?
Cdigo
%Funcion de entrenamiento
function y=ff(x)
y=x.**2 -3*x-1;
end
Manual:
Corrida de Carpeta:
-------------------------------------------------------------------------------------
---------------
INFORME DE LABORATORIO N05
Fecha 08/09/2016
Que es?
Es un programa de aproximacion
Cmo es?
Que hace?
Variables:
Cdigo:
function y=derivando(f,h,a,c)
f=inline(f);
x=a:h:c;
dff=(f(x+h)-f(x))/h;
plot(x,f(x))
hold
plot(x,dff,'r')
hold off
end
Manual de uso:
Corrida de carpeta:
derivando('sin(x)',0.00001,-pi,pi)
INFORME DE LABORATORIO N6
Fecha : 13/09/2016
Qu es?
Cmo es?
Qu hace?
Cdigo
function y= puntofijo1(fxx,r,error1,n)
ffx= inline(fxx);
for i=1:n;
t= ffx(r);
error= abs(t-r);
if error< error1
break
else
r=t;
end
end
fprintf('RAIZ=%f Aproximacion=%e\n',t,error)
Manual
Corrida de Carpeta
INFORME DE LABORATORIO N07
QU ES?
CMO ES?
Su estructura es la siguiente :
switch (variable_switch)
comandos
...
otherwise
comandos adicionales
endswitch
QU HACE?
Variables:
Se definen las variables en determinados case
6.- break
Cdigo:
% PROGRAMA INTERACTIVO
# Ir a Command Window para empezar programa
opcion=menu('Seleccione una opcion:','ADICION DE DOS
NUMEROS', ...
'RAIZ CUADRADA DE UN NUMERO','RAIZ ENESIMA','FUNCION
DERIVADA', ...
'TANGENTE','Salir Programa');
switch(opcion)
case(1)
a=input('Por favor ingrese un numero='); b=input('Por favor
ingrese un numero=');
suma=a+b
disp('ADICION')
witch16
case(2)
r=input('Por favor ingrese un numero=');
raizcuadrada=r**(1/2)
('RAIZ CUADRADA')
case(3)disp
u=input('Por favor ingrese un numero='); n=input('Por favor
ingrese el numero n=');
raizenesima=u**(1/n)
disp('RAIZ ENESIMA')
case(4)
x=-6:0.1:6;
disp('PRECAUCION ---- INGRESE LA FUNCION ENTRE
APOSTROFOS')
disp('Introduzca una funcion');
f=input('f(x)='); h=input('por favor indique con que
APROXIMACION DESEA h=');
f=inline(f);
dff=(f(x+h)-f(x))/h;
plot(x,f(x),'linewidth',3,x,dff,'r','linewidth',3)
witch16
case(5)
x=-6:0.1:6;
h=0.00001;
disp('PRECAUCION ---- INGRESE LA FUNCION ENTRE
APOSTROFOS')
disp('Por favor ingrese una funcion');
f=input('f(x)='); k=input('Por favor ingrese donde quiere la recta
tangente =');
f=inline(f); dfu=(f(k+h)-f(k))/h; s=dfu*(x-k)+f(k);
plot(x,f(x),'linewidth',3)
hold
plot(x,s,'r','linewidth',3)
hold off
disp('TANGENTE A LA CURVA')
case(6)
break;
otherwise
disp(['No hacerto'])
end
Manual
Corrida de Carpeta
--------------------------------------------------------------------------------------------------
---------------
INFORME DE LABORATORIO N8
Fecha : 27/09/2016
Qu es?
Cmo es?
Qu hace?
Linea de Comandos
GUARDAR GRAFICA
print("john1.png","-dpng")
plot([1 -2 3 -4])
plot([1 -2 3 -4 5])
print('john2.png','-dpng')
DIAGRAMA DE BARRAS
x=[2 4 7 5 1]
bar(x)
# sale diagrama de barras
plot(x)
hold
bar(x)
hold off
barh(x)
bar3d(x)
bar3(x)
# no sale
DIAGRAMA DE TORTA
pie(x)
pie3(x)
REA
area(x)
HISTOGRAMAS
hist(x)
y=[1 1 4 5 2 2 2 2 7 8]
hist(y)
hist(y,'c')
# se le pone titulo
GRFICA DE UNA CURVA EN EL ESPACIO
ezplot3('sin(t)','cos(t)','t')
ezplot3('sin(t)','cos(t)','t','r','linewidth',7)
x=sin(t);
t=-7:0.1:7
plot(x,y,z,'r','linewidth',7)
plot3(x,y,z,'r','linewidth',7)
plot3(x,y,z,'.','markersize',7)
plot3(x,y,z,'.r','markersize',7)
plot3(x,y,z,'p','markersize',7)
plot3(x,y,z,formacolor,markersize,(tamaosinparentesis))
plot3(z,x,y,'linewidth',10)
plot3(y/2,z*4,x.**2,'linewidth',10)
plot3(y/2,z*4,x.**2,'pr','markersize',10)
plot3(y/2,z*4,x.**2,'pr','markersize',20)
x=-7:0.1:7; x=y;
[x y]= meshgrid(x,y);
z= x.**2-y.**2;
mesh(x,y,z)
aleatoria
u=rand(6)
mesh(u)
mesh(u,'linewidth',50)
mesh(u,'linewidth',50)
mesh(x,y,z,'linewidth',7)
meshc(x,y,z,'linewidth',7)
#malla con linea de grueso 7 y malla con curvas de nivel con linea de
grueso 7 respectivamente.
surf(x,y,z)
surfc(x,y,z,'linewidth',4)
Manual
Corrida de Carpeta
INFORME DE LABORATORIO N09
Fecha : 06 / 10 / 2016
QU ES?
CMO ES?
QU HACE?
px : potencia de x
fac1 :factorial i
function y=sen15(x,n)
su=0; fac1=1; px=1; nsig=1;
for i=1:n
px=px*x;
fac1=fac1*i;
if mod (i,2)~=0
su=su+px/fac1*nsig;
nsig=nsig*(-1);
end
end
y=su;
f=sin(x)
px: potencia de x
fac1 : factorial i
function y=coseno16(x,n)
for i=1:n
px=px*x
fac1=fac1*i
if mod(i,2)==0
a=a+px/fac1*nsig
nsig=nsig*(-1)
end
end
y=a
b=cos(x)
Fecha : 11/10/2016
Qu es?
Qu hace?
Cdigo
function y= aprasin(x,n)
for i=1:n;
factk=factk*i; % factorial de k
if mod(i,2)~=0
asen= asen+(coefx**2)*xalak/factk ;
end
end
format long
y= asen;
Manual
Corrida de Carpeta
INFORME DE LABORATORIO N11
QU ES?
CMO ES?
QU HACE?
Variables:
Cdigo:
function y=senh16(x,n)
cie=0;
for i=0:n
px=x^(2*i+1);
fac=factorial(2*i+1);
cie=cie+(px)/fac;
end
disp('senohiperbolico prog')
y=cie
disp('verdadero')
sinh(x)
Manual
Corrida de Carpeta
INFORME DE LABORATORIO N12
Fecha : 20/10/2016
Qu es?
Son programas que combinan el uso del for con la bifurcacion if para
aproximarse con determinado nmero determinado de iteraciones a
los valores del sin(x+a) y cos(x+a) respectivamente.
Cmo es?
Qu hace?
Cdigo 1
function y=sinxa(x,a,n)
for i=1:n;
coef=sin(a+(i*pi/2));
xalap= xalap*x;
denom= denom*(i);
end
y= aprsxa;
Cdigo 2
function y=cosxa(x,a,n)
for i=1:n;
coef=cos(a+(i*pi/2));
xalap= xalap*x;
denom= denom*(i);
end
y= aprcxa;
Manual
Corrida de Carpeta 1
Corrida de Carpeta 2
INFORME DE LABORATORIO N013
QU ES?
CMO ES?
QU HACE?
Calcula un numero "u" que sea parte del dominio de una funcin "f"
tal que f(u)=0 , el numero u por lo general es un valor aproximado
pues f(x) no necesariamente es lineal.
Variables:
Cdigo:
function y=aprcero(g,a,b,err)
f= inline(g); c=0; apr=(b-a)/2;
while apr>err
c= (a+b)/2;
if f(a)*f(c)<0
b=c;
else a=c;
end
apr=(b-a)/2;
end
disp('un cero de la funcion f entre a y b es aproximadamente:')
y=c;
endfunction
Manual
Corrida de Carpeta
INFORME DE LABORATORIO N14
Fecha : 13/12/2016
Qu es?
Cmo es?
Qu hace?
Cdigo
function y=metodoc(g,a,b,err)
while apr>err
r= b-((f(b)*(b-a))/(f(b)-f(a)));
if f(a)*f(r)<0
b=r;
else a=r;
end
apr=abs(f(r));
end
Manual
Corrida de Carpeta
INFORME DE LABORATORIO N015
QU ES?
CMO ES?
QU HACE?
Variables:
B: transpuesta de la matriz A
Cdigo:
Manual
Corrida de Carpeta
INFORME DE LABORATORIO N016
QU ES?
CMO ES?
QU HACE?
Variables:
Cdigo:
function y=hermite(x,n)
if n==0
y=1
elseif n==1
y=2*x
else y=2*x*hermite(x,n-1)-2*(n-1)*hermite(x,n-2)
end
Manual
P=input('P=')
p=size(P)
for i=1:p-1
for j=i+1:p
P(j,i+2)=(P(j,i+1)-P(j-1,i+1))/(P(j,1)-P(j-i,1))
end
end
Corrida de carpeta :
corrida de carpeta :
INFORME DE LABORATORIO N18
Fecha : 10/01/2017
Qu es?
Cmo es?
f: file
open: abrir
Qu hace?
Cdigo
x=rand(2,4)
var1= fopen('prueba.m','w')
fclose(var1)
Manual
Corrida de Carpeta