09/04/18
GUIDE (GRAFICOS MATLAB)
Subplot (m,n,k)
Grafico 1 Grafico 2 Grafico 3
n-> Numero de filas
m-> Numero de columnas
k-> Subdivision activada
subplot(3,2,1),plot(…)
Ejemplo:
t=0:0.3:5;
>> x=t.^2;
>> y= 2*t-5
>> z= sin(t)
>> u=cos(t);
>> v=abs(t);
>> w=sqrt(t);
>> subplot(3,2,1),plot(t,x,'r'),title('GRAFICO 1');
>> subplot(3,2,2),plot(t,y,'b'),title('GRAFICO 2');
>> subplot(3,2,3),plot(t,z,'y'),title('GRAFICO 3');
>> subplot(3,2,4),plot(t,u,'m'),title('GRAFICO 4');
>> subplot(3,2,5),plot(t,v,'g'),title('GRAFICO 5');
>> subplot(3,2,6),plot(t,w,'s'),title('GRAFICO 6');
>> subplot(3,2,4),fill(t,u,'r'),title('GRAFICO 4'); FILL ES PARA RELLENAR EL AREA BAJO LA
CURVA
>> subplot(3,2,4),fill(t,u,'r'),title('GRAFICO 4');
BURBUJAS
clear,clc,hold off
axis([-0. 1. -0. 1.])
axis('square')
axis('off')
hold on
plot([0,1,1,0,0],[0,1,1,0,0])
h=pi/10;
t=0:h:pi/2;
xx=cos(t);
yy=sin(t);
for n=1:60
r =rand(1)*0.1;
xc=rand(1);
yc=rand(1);
x=xx*r+xc;
y=yy*r+yc;
plot(x,y)
end
hold off
GRAFICOS 3D
t=-6:0.2:8;
>> x=t;
>> y=3-t;
>> z=cos(t);
>> plot3(x,y,z)
>> grid
CLC;CLF BORRAR GRAFICO
GRAFICOS EN UN PLANO
[x,y]=meshgrid(-2:0.2:2); meshgrid-> Poner cuadriculado integrada a nuestra gráfica.
>> z=x.*exp(x.^2-y.^2);
>> mesh(x,y,z) MESH-> GRAFICOS EN UN PLANO
>> title('z=x.*exp(-x.^2-y.^2)');
>> xlabel('x');ylabel('y');zlabel('z');
>> zoom on
>> zoom off
>>