Vous êtes sur la page 1sur 6

EJEMPLOS DE GRAFICA DE FUNCIONES

1.

Graficar

( )

x=[-3:.5:3];
y=x.^2;
plot(x,y)

2.

Graficar ( )

] (tipo line).

x=[-1:0.1:5];
y=sin(x.^2);
plot(x,y)

3.

Graficar

( )

] (tipo bar)

x=[-3:0.2:3];
y=exp(-x.^2);
bar(x,y)

4.

Graficar ( )

( )

] (tipo stairs)

( )

] (tipo polar)

x=[0:0.2:10];
y=sin(x);
stairs(x,y)

5.

Graficar ( )

x= [0:0.2:10];
y=sin(x);
polar(x,y)

6.

Graficar ( )

( )

] (tipo fplot)

] (tipo stem)

x=[0:0.1:2*pi];
y=abs(sin(2*x).*cos(2*x));
stem(x,y)

7.

Graficar x ( tipo pie)

x=[1:2:9];
pie(x)

8.

Graficar ( )

fplot('cos(x)',[-3,3])

9.

Graficar y especificar el tipo de marca ( )

x=[-3:0.2:4];
y=sin(x).^3-x;
plot(x,y,'o')

10.Graficar y especificar el color de la lnea

x=[1:0.2:10];
y=cos(x);
fill(x,y,'m')

( )

( )

] m es el color de la linea

11.Poner leyendas
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,'-.sr','linewidth',2,'LineStyle','--','Color','r','MarkerEdgeColor','k','MarkerEdgeColor','g','MarkerSize',10);
grid on;

12.MLTIPLES GRAFICAS
x= 0:0.05:5;
y=sin(x);
z=cos(x);
plot(x,y,x,z)

13.MLTI graficas hold on incrementa las grficas en una sola ventana


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, 'g')
grid

14.GRAFICAS EN MLTIPLES EJES, subplot(m,n,k); m filas n columnas

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('Grafica 1');
subplot(3,2,2),plot(t,y),title('Grafica 2');
subplot(3,2,3),plot(t,z),title('Grafica 3');
subplot(3,2,4),plot(t,u),title('Grafica 4');
subplot(3,2,5),plot(t,v),title('Grafica 5');
subplot(3,2,6),plot(t,w),title('Grafica 6');

15.GRAFICAS EN 3D O EN TRES DIMENSIONES


plot3
t=-6:0.2:8;
x=t;
y=3-t;
z=cos(t);
plot3(x,y,z);
grid

k secuencia de grficas.

16. fill3

c=[1 0.8 0.1] intensidad de 0.1 : [rojo verde azul]

t=[-6:0.2:8];
x=t;
y=3-t;
z=cos(t);
c=[1 0.8 0.1];
fill3(x,y,z,c);
grid

17.Utilizaremos [x,y]=meshgrid(-2:0.0:2) para definir 2 matrices con valores


idnticos, los valores de z dependern de esta dos matrices. Las funciones surf y
mesh,dibujan funciones tridimensionales. Con view(azimut,elev) se puede
visualizar la direcciond e observacin; donde azimut es el angulo de rotacin de
un plano horizontal, y elev es el angulo de elevacin respecto al plano.

[x,y]=meshgrid(-2:0.2:2);
z=x.*exp(-x.^2-y.^2);
mesh(x,y,z);
title('z=x.*exp(-x.^2-y.^2)');
xlabel('x');ylabel('y');zlabel('z');

18.Meshc

[x,y]=meshgrid(-2:0.2:2);
z=x.*exp(-x.^2-y.^2);
meshc(x,y,z);
title('z=x.*exp(-x.^2-y.^2)');
xlabel('x');ylabel('y');zlabel('z');

19.

Vous aimerez peut-être aussi