Documentos de Académico
Documentos de Profesional
Documentos de Cultura
2x-y+z=3
x+y=3
y-3z=7
----------------
>> A = [3 -1 0; -2 1 1; 2 -1 4]
A=
3 -1 0
-2 1 1
2 -1 4
>> b= [5;0;15]
b=
15
>> n = length(b)
n=
3
>> d = det(A) %determinante de A
d= det(A); %determinante de A
Ab= [A(:,1:i-1),b,A(:,i+1:n)];
x(i)=det(Ab)/d;
end
>> disp('solution')
solution
>> disp(x);
2.0000
1.0000
3.0000
----------------------------
###GRFICAS###
fplot('sin(x^2)',[0 10])
>> plot(x,y)
>> x = linspace(0,3,50);
>> e1 = exp(-x.^2);
>> e2 = (x.^2).*exp(-x.^2);
>> e3 = x.*(exp(-x.^2));
>> e4 = exp(-x);
>> plot(x,e1,'+-r',x,e2,'+-b',x,e3,'+-g',x,e4,'+-y')
>> x = linspace(0,3,50);
>> e1 = exp(-x.^2);
>> e2 = (x.^2).*exp(-x.^2);
>> e3 = x.*(exp(-x.^2));
>> e3 = x.*(exp(-x.^2));
>> e4 = exp(-x);
>> subplot(2,2,1); -------------------> NOTA: (A,B,C) A=Columna | B=Fila | C=Funciones, num que te
dan
>> plot(x,e1);
>> subplot(2,2,2);
>> plot(x,e2);
>> subplot(2,2,3);
>> plot(x,e3);
>> subplot(2,2,4)
>> plot(x,e4);
####GRAFICA PARA FIGURAS CON NOMBRE###
>> t = 0:0.2:2*pi+0.2;
x=sin(t);
y=cos(t);
>> subplot(3,1,1);
plot(x,y,'-');
>> subplot(3,1,2);
plot(x,y,'-');
axis square;
>> subplot(3,1,3);
plot(x,y,'-');
--------------------------------------------------------
-------------------------------------------------------
w = 0:00001:100000
-------------------------------------------------------
###Grficas 3D###
>> x = linspace(0,10*pi,1000);
>> y=cos(x);
>> z=sin(x);
>> plot3(x,y,z)
>> plot3(x,y,z,'r')
>> plot3(x,y,z,'r','linewidth',2)
>> grid;
>> xlabel('angulo')
<<Sale la grfica>>
###Grficas Animadas###
>> t=[0:pi/50:10*pi];
>> Hold off <----------------------------Para mantener una sola grfica, sin modificar.
###Grfica dimensional###
>> z=[1 2 3 4 5 6 7 8 9 10; 2 4 6 8 10 12 14 16 18 20; 3 4 5 6 7 8 9 10 11 12]
z=
1 2 3 4 5 6 7 8 9 10
2 4 6 8 10 12 14 16 18 20
3 4 5 6 7 8 9 10 11 12
>> mesh(z)
>> x=linspace(1,50,10);
>> y=linspace(500,1000,3);
>> mesh(x,y,z)
###Grfica chida###
>> x=[-2:0.2:2];
>> y=[-2:0.2:2];
>> Z=X.*exp(-X.^2-Y.^2);
otro ejemplo:
>> x=[-2.1:0.15:2.1];
>> y=[-6:0.15:6];
>> Z = 80*Y.^2.*exp(-X.^2-0.3*Y.^2);
>> mesh(X,Y,Z)
otro ejem:
x= [-2:0.2:2];
>> [X,Y]=meshgrid(x,y);
>> Z= X.*exp(-X.^2-Y.^2);
>> subplot(1,2,1)
>> subplot(1,2,2)
javier 19
fernando 27
pablo 26
>> subplot(1,2,1);
otro ejemplo:
>> x= [-10:0.1:10];
>> y=x;
>> [X,Y]=meshgrid(x,y);
>> Z=sin(sqrt(X.^2+Y.^2))./sqrt(X.^2+Y.^2+0.1);
>> colormap(hot);
>> colormap('default')
para cambiar:
>> c=contour3(X,Y,Z);
>> clabel(c);
----------------
x = linspace(0,3,50);
e1 = exp(-x.^2);
e2 = (x.^2).*exp(-x.^2);
e3 = x.*(exp(-x.^2));
e4 = exp(-x);
plot(x,e1,'+-r',x,e2,'+-b',x,e3,'+-g',x,e4,'+-y')
---------------------------------------------------
t= 0:0.2:2*pi+0.2;
x=sin(t);
y=cos(t);
subplot(3,1,1);
plot(x,y,'-');
subplot(3,1,2);
plot(x,y,'-');
axis square;
subplot(3,1,3);
plot(x,y,'-');
axis([-2 2 -3 3]);
title('Grfica De Crculos')
-----------------------------------------------------
x = [1 5 4 2];
y = [1 0 4 3];
fill(x,y,'r')
x = [1 1 4 6; 2 -2 2 -5; 3 -2 1 -1]
x=
1 1 4 6
2 -2 2 -5
3 -2 1 -1
---------------------------------------------------------
>> x = (-1:.1:1);
>> y = x.^2-2*x-5/6;
>> x = (-1:.1:1);
>> y = x.^2-2*x-5/6;
>> hold on
>> xlabel('x')
>> ylabel('y')
>>
>> x = (-2:.1:2);
>> y = x.^2-2*x-5/6;
>> xlabel('x')
>> ylabel('y')
>>
>> x = (-3:.1:3);
>> y = x.^2-2*x-5/6;
>>
200