Академический Документы
Профессиональный Документы
Культура Документы
1.
>> x=-1:0.1:0.5;
>> y=sin(x.^2);
>> plot(x,y)
>> x=-3:0.2:3;
>> y=exp(-x.^2);
>> plot(x,y)
>> x=-3:0.2:3;
>> y=exp(-x.^2);
>> bar(x,y)
>> x=0:0.2:10;
>> y=sin(x);
>> plot(x,y)
>> x=0:0.2:10;
>> y=sin(x);
>> stairs(x,y)
>> x=0:0.1:2*pi;
>> y=sin(x);
>> polar(x,y)
>> fplot('cos(x)',[-3,3])
>> x=1:0.2:10;
>> y=11+exp(-x.^2);
>> loglog(x,y)
>> x=-3:0.2:4;
>> y=(sin(x)).^3-x;
>> plot(x,y,'o')
>> plot(x,y,'*','color','r')
>> plot(x,y,'*','color','b')
>> x=-5:0.1:5;
>> y=sin(x)-cos(x).^2;
>> plot(x,y,'*','color','b')
>> x=-2:0.2:2;
>> y=abs(cos(x));
>> plot(x,y,'*')
>>
>> x=-3:0.2:3;
>> y=-x.^2+3*x+8;
>> plot(x,y,'+')
>> plot(x,y,'--')
>> x=1:0.2:10;
>> y=cos(x);
>> plot(x,y,'--')
>> x=0:0.1:4*pi;
>> y=sin(x)./(1+cos(x));
>> plot(x,y)
>> xlabel('X'),ylabel('Y')
>> title('y=sin(x)./(1+cos(x))')
>>
>> x=-2:0.05:5;
>> y=-x.^2+sin(x);
>> h=plot(x,y);
>> text(2.7,-4,'y=-x.^2+sin(x)');
>> xlabel('valores de x');
>> ylabel('valores de y');
>> legend('CURVA X vs Y');
>> set(h,'LineWidth',2,'LineStyle','--','Color','r');
>> grid on;
>> figure;
>> plot(x,y,'-.rs','LineWidth',2,'LineStyle','--
','Color','r','MarkerEdgeColor','k','MarkerFaceColor'
,'g',...
'MarkerSize',10);
>> grid on;
MULTIPLES GRAFICOS EN UNA SOLA VENTANA FIGURE
>> x=0:0.05:5;
>> y=sin(x);
>> z=cos(x);
>> plot(x,y,x,z)
>> x=0:0.05:5;
>> y=sin(x);
>> z=cos(x);
>> plot(x,y,x,z);
>> hold on;
>> w=abs(x-2);
>> plot(x,w,'r')
>> 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),title('GRAFICO 1');
>> subplot(3,2,2),plot(t,y),title('GRAFICO 2');
>> subplot(3,2,3),plot(t,z),title('GRAFICO 3');
>> subplot(3,2,4),plot(t,u),title('GRAFICO 4');
>> subplot(3,2,5),plot(t,v),title('GRAFICO 5');
>> subplot(3,2,6),plot(t,w),title('GRAFICO 6');
ESTE PROGRAMA FUE ELABORADO EN EL
SCRIPT
%PROGRAMA PARA GRAFICAR
x=linspace(1,5,17);
y1=27*exp(-2*x);
y2=15*0.3.^x;
%plot1
subplot(2,2,1)
plot(x,y1,'*',x,y2)
%plot2
subplot(2,2,2)
semilogy(x,y1,'*',x,y2)
%plot3
subplot(2,2,3)
semilogx(x,y1,'*',x,y2)
%plot4
subplot(2,2,4)
loglog(x,y1,'*',x,y2)
>> x=-2*pi:0.2:2*pi;
>> subplot(3,1,1),ezplot('sin(x)')
>> subplot(3,1,2),ezplot('sin(2*x)')
>> subplot(3,1,3),ezplot('y=tan(x)')
%Ejemplo de fplot
fplot('[tan(x),sec(x),cot(x)]',[-pi pi -3 3])
xlabel('x');ylabel('y');
title('[tan(x),sec(x),cot(x)] vs x, para -pi<x<pi')
>> t=0:0.1:4*pi;
>> X=sin(-t)+t;
>> Y=1-cos(-t);
>> plot(X,Y)
>> xlabel('x=sin(t)+t')
>> ylabel('y=1-cos(-t)')
>>
%FUNCION DEFINIDA POR
INTERVALOS
>> x=-10:.1:-5;
>> y=2+sin(x);
>> z=-5:.1:2;
>> v=log(u.^2+1);
>> u=2:.1:10;
>> t=exp(z);
>> grid on
>> plot(x,y,z,t,u,v)
>> xlabel('x'), ylabel('f(x)')
>> title('Representacion grafica de una
funcion definida por intervalos')
GRAFICOS EN 3D
plot3
>> t=-6:0.2:8;
>> x=t;
>> y=3-t;
>> z=cos(t);
>> plot3(x,y,z);
>> grid
fill3
>> t=-6:0.2:8;
>> x=t;
>> y=3-t;
>> z=cos(t);
>> fill3(x,y,z,t);
%PROGRAMA QUE RETORNA EL GRAFICO DE
Z=sin(2x).cos(2y)exp(-sqrt(x^2+y^2)/2)
%EL RANGO ES: EN X -PI a PI , EN Y -PI
a PI
x=linspace(-pi,pi,100);
y=linspace(-pi,pi,100);
[X,Y]=meshgrid(x,y);
Z=sin(2.*Y).*cos(2.*X).*exp(-
sqrt(X.^2+Y.^2)./2);
subplot(2,1,1);
mesh(X,Y,Z)
xlabel('X'),ylabel('Y'),zlabel('z')
title('Mesh Plot')
subplot(2,1,2);
surf(X,Y,Z)
xlabel('X'),ylabel('Y'),zlabel('Z')
title('Surf Plot')
>> [x,y]=meshgrid(-3:0.2:3);
>> z=x.^2-y.^2-9;
>> meshz(x,y,z)
>> title('z=x.^2-y.^2-9');
>> xlabel('x');ylabel('y');zlabel('z');
surf:
>> [x,y]=meshgrid(-2:0.2:2);
>> z=x.*exp(-x.^2-y.^2);
>> surf(x,y,z);
>> title('GRAFICO DE Z=x.*exp(-x.^2-y.^2)');
>> xlabel('x');ylabel('y');zlabel('z');
figure(1);
mesh(x,y,z);
box on;axis on;
xlabel('x-axis');ylabel('y-
axis');zlabel('z-axis')
title('PLOT USANDO mesh')
figure(2);
meshc(x,y,z); FIGURA2
box on;axis on;
xlabel('x-axis');ylabel('y-
axis');zlabel('z-axis')
title('PLOT USANDO meshc')
figure(3);
meshz(x,y,z);
box on;axis on;
xlabel('x-axis');ylabel('y-
axis');zlabel('z-axis')
title('PLOT USANDO meshz')
figure(4);
surf(x,y,z);
box on;axis on;
xlabel('x-axis');ylabel('y-
axis');zlabel('z-axis')
title('PLOT USANDO surf')
figure(5); FIGURA3
surfc(x,y,z);
box on;axis on;
xlabel('x-axis');ylabel('y-
axis');zlabel('z-axis')
title('PLOT USANDO surfc')
figure(6);
waterfall(x,y,z);
box on;axis on;
xlabel('x-axis');ylabel('y-
axis');zlabel('z-axis')
title('PLOT USANDO waterfall')
FIGURA5 FIGURA4
FIGURA6