Sunteți pe pagina 1din 8

Sarcina Lucrării nr.

2
I. Descrieţi comenzile de bază pentru construirea graficelor în pachetul MATLAB.
II. a
figure(1)
x=[-1:0.01:2];
f=exp(x).*sin(x.^2);
plot(x,f,'g-h');
title('Graficul f(x)');
xlabel('x');
ylabel('y');
legend('f(x)')

figure(2)
x=[-1:0.01:2];
g=x.*(cos(x)).^2;
plot(x,g,'b:p');
title('Graficul g(x)');
xlabel('x');
ylabel('y');
legend('g(x)');

II.b

figure(3)
x=[-1:0.01:2];
f=exp(x).*sin(x.^2);
g=x.*(cos(x)).^2;
hold on
plot(x,f,'g-h');
plot(x,g,'b:p');
title('Graficul f(x) si g(x)');
xlabel('x');
ylabel('y');
legend('f(x)','g(x)');
II.c1

figure(4)
subplot(3,1,1);
x=[-1:0.01:2];
f=exp(x).*sin(x.^2);
plot(x,f,'g-h');
title('Graficul f(x)');
xlabel('x');
ylabel('y');
legend('f(x)')
subplot(3,1,2);
x=[-1:0.01:2];
g=x.*(cos(x)).^2;
plot(x,g,'b:p');
title('Graficul g(x)');
xlabel('x');
ylabel('y');
legend('g(x)');
subplot(3,1,3);
x=[-1:0.01:2];
f=exp(x).*sin(x.^2);
g=x.*(cos(x)).^2;
hold on
plot(x,f,'g-h');
plot(x,g,'b:p');
title('Graficul f(x) si g(x)');
xlabel('x');
ylabel('y');
legend('f(x)','g(x)');
figure(5)
subplot(1,3,1);
x=[-1:0.01:2];
f=exp(x).*sin(x.^2);
plot(x,f,'g-h');
title('Graficul f(x)');
xlabel('x');
ylabel('y');
legend('f(x)')
subplot(1,3,2);
x=[-1:0.01:2];
g=x.*(cos(x)).^2;
plot(x,g,'b:p');
title('Graficul g(x)');
xlabel('x');
ylabel('y');
legend('g(x)');
subplot(1,3,3);
x=[-1:0.01:2];
f=exp(x).*sin(x.^2);
g=x.*(cos(x)).^2;
hold on
plot(x,f,'g-h');
plot(x,g,'b:p');
title('Graficul f(x) si g(x)');
xlabel('x');
ylabel('y');
legend('f(x)','g(x)');
II.c2

figure(6)
subplot(2,2,1);
x=[-1:0.01:2];
f=exp(x).*sin(x.^2);
plot(x,f,'g-h');
title('Graficul f(x)');
xlabel('x');
ylabel('y');
legend('f(x)')
subplot(2,2,3);
x=[-1:0.01:2];
g=x.*(cos(x)).^2;
plot(x,g,'b:p');
title('Graficul g(x)');
xlabel('x');
ylabel('y');
legend('g(x)');
subplot(1,2,2);
x=[-1:0.01:2];
f=exp(x).*sin(x.^2);
g=x.*(cos(x)).^2;
hold on
plot(x,f,'g-h');
plot(x,g,'b:p');
title('Graficul f(x) si g(x)');
xlabel('x');
ylabel('y');
legend('f(x)','g(x)');
figure(7)
subplot(2,2,3);
x=[-1:0.01:2];
f=exp(x).*sin(x.^2);
plot(x,f,'g-h');
title('Graficul f(x)');
xlabel('x');
ylabel('y');
legend('f(x)')
subplot(2,2,4);
x=[-1:0.01:2];
g=x.*(cos(x)).^2;
plot(x,g,'b:p');
title('Graficul g(x)');
xlabel('x');
ylabel('y');
legend('g(x)');
subplot(2,1,1);
x=[-1:0.01:2];
f=exp(x).*sin(x.^2);
g=x.*(cos(x)).^2;
hold on
plot(x,f,'g-h');
plot(x,g,'b:p');
title('Graficul f(x) si g(x)');
xlabel('x');
ylabel('y');
legend('f(x)','g(x)');
III. De construit graficul funcţiei de două variabile pe un sector dreptunghiular. Utilizaţi funcţiile
grafice - mesh, surf, meshc, surfc, contour, contourf, contour3. Cotele la graficele de contur se aleg
de sinestătător

[x,y]=meshgrid(0:0.1:pi, 1:0.1:5);
z=x.*sin(x).*log(y);
figure(8);
mesh(x,y,z);
title('mesh');
figure(9);
surf(x,y,z);
title('surf');
figure(10);
meshc(x,y,z);
title('meshc');
figure(11);
surfc(x,y,z);
title('surfc');
figure(12);
contour(x,y,z);
title('contour');
figure(13);
contourf(x,y,z);
title('contourf');
figure(14);
contour3(x,y,z);
title('contour3')

S-ar putea să vă placă și