Documente Academic
Documente Profesional
Documente Cultură
Moldova
Universitatea Tehnică a Moldovei
RAPORT
Despre lucrarea de laborator Nr.2
la Mecanică realizată în MATLAB
Chişinău 2018
Scopul lucrării: Însuşirea şi dezvoltarea elementelor de bază de construire a
graficelor în sistemul MATLAB.
Mersul lucrării:
Exerciţiul 1:
Descrieţi comenzile de bază pentru construirea graficelor în pachetul MATLAB.
Exerciţiul 2:
a) în ferestre diferite
>> x=[-1:0.05:3];
>> f=x.*sin(x);
>> plot(x,f,'yp--');
>> title('Graficul functiei f(x)')
>> ylabel('axa 0y');
>> xlabel('axa 0x');
>> legend('f(x)')
>> clf reset
>>x=[-1:0.02:3];
>>g=x.*(log(abs(x))+1);
>>plot(x,g,'cs-.');
>> title('Graficul functiei g(x)');
>> xlabel('axa 0x');
>> ylabel('axa 0y');
>> legend('g(x)');
g(x)
f(x) şi g(x)
>> subplot(3,1,1);
>>x=[-1:0.05:3];
>>f=x.*sin(x);
>>plot(x,f,'yp--');
>>title('Graficul functiei f(x)');
>>ylabel('axa 0y');
>>xlabel('axa 0x');
>>legend('f(x)');
>> subplot(3,1,2);
>> x=[-1:0.02:3];
>>plot(x,g,'cs-.');
>> title('Graficul functiei g(x)');
>> xlabel('axa 0x');
>>ylabel('axa 0y');
>>legend('g(x)');
>> subplot(3,1,3);
>> x=[-1:0.05:3];
>>g=x.*(log(abs(x))+1);
>>f=x.*sin(x);
>>plot(x,f,'yp--',x,g,'cs-.');
>>title('Graficul combinat f(x) si g(x)');
>>xlabel('axa 0x');
>>ylabel('axa 0y');
>>legend('f(x)','g(x)');
f(x) g(x) f(x) şi g(x)
Vertical
ambele pe axele
din dreapta
>>clf reset;
>>figure (2);
>>x=[-1:0.05:3];
>>f=x.*sin(x);
>>g=x.*(log(abs(x))+1);
>>subplot(1,3,1);
>>plot(x,f,'yp--');
>>xlabel('Axa 0x');
>>ylabel('Axa 0y');
>>legend('f(x)');
>>subplot(1,3,2);
>>plot(x,g,'cs-.');
>>xlabel('Axa 0x');
>>ylabel('Axa 0y');
>>legend('g(x)');
>>subplot(1,3,3);
>>hold on;
>>plot(x,f,'yp--');
>>plot(x,g,'cs-.');
>>xlabel('Axa 0x');
>>ylabel('Axa 0y');
>>legend('f(x)','g(x)')
c2) Într-o fereastră – fiecare aparte pe axe diferite şi ambele pe aceleaşi axe.
>>clf reset;
>>figure(3);
>>x=[-1:0.05:3];
>>f=x.*sin(x);
>>g=x.*(log(abs(x))+1);
>>subplot(2,2,1);
>>plot(x,f,'yp--');
>>title('Graficul functiei f(x)');
>>xlabel('Axa 0x');
>>ylabel('Axa 0y');
>>legend('f(x)');
>>subplot(2,2,3);
>>plot(x,g,'cs-.');
>>title('Graficul functiei g(x)');
>>xlabel('Axa 0x');
>>ylabel('Axa 0y');
>>legend('g(x)');
>>subplot(1,2,2);
>>hold on;
>>plot(x,f,'yp--');
>>plot(x,g,'cs-.');
>>xlabel('Axa 0x');
>>ylabel('Axa 0y');
>>title('Graficul functiilor f(x) si g(x)');
>>legend('f(x)','g(x)')
Ambele pe axele de sus
>>clf reset;
>>figure(4);
>>x=[-1:0.05:3];
>>f=x.*sin(x);
>>g=x.*(log(abs(x))+1);
>>subplot(2,2,3);
>>plot(x,f,'yp--');
>>title('Graficul functiei f(x)');
>>xlabel('Axa 0x');
>>ylabel('Axa 0y');
>>legend('f(x)');
>>subplot(2,2,4);
>>plot(x,g,'cs-.');
>>title('Graficul functiei g(x)');
>>xlabel('Axa 0x');
>>ylabel('Axa 0y');
>>legend('g(x)');
>>subplot(2,1,1);
>>hold on;
>>plot(x,f,'yp--');
>>plot(x,g,'cs-.');
>>xlabel('Axa 0x');
>>ylabel('Axa 0y');
>>title('Graficul functiilor f(x) si g(x)');
>>legend('f(x)','g(x)')
Exerciţiul 3:
Metoda Mesh
>> [x,y]=meshgrid(-1:0.1:1,-2:0.1:2);
>> z=x.^2.*cos(x.*y).*(log(abs(x.*y))+x);
>> figure(1);
>> mesh(x,y,z);
>> title('Mesh');
Metoda Surf
>> [x,y]=meshgrid(-1:0.1:1,-2:0.1:2);
>> z=x.^2.*cos(x.*y).*(log(abs(x.*y))+x);
>> figure(2);
>> surf(x,y,z);
>> title('Surf');
Metoda Meshc
>> [x,y]=meshgrid(-1:0.1:1,-2:0.1:2);
>>z=x.^2.*cos(x.*y).*(log(abs(x.*y))+x);
>> figure(3);
>>meshc(x,y,z);
>>title('Meshc');
Metoda Surfc
>> [x,y]=meshgrid(-1:0.1:1,-2:0.1:2);
>>z=x.^2.*cos(x.*y).*(log(abs(x.*y))+x);
>> figure(4);
>>surfc(x,y,z);
>> title('Surfc');
Metoda Contour
>> [x,y]=meshgrid(-1:0.1:1,-2:0.1:2);
>>z=x.^2.*cos(x.*y).*(log(abs(x.*y))+x);
>> figure(5);
>>contour(x,y,z);
>>title('Contour');
Metoda Contourf
>> [x,y]=meshgrid(-1:0.1:1,-2:0.1:2);
>>z=x.^2.*cos(x.*y).*(log(abs(x.*y))+x);
>> figure(6);
>>contourf(x,y,z);
>>title('Contourf');
Metoda Contour3
>> [x,y]=meshgrid(-1:0.1:1,-2:0.1:2);
z=x.^2.*cos(x.*y).*(log(abs(x.*y))+x);
>> figure(7);
contour3(x,y,z);
title('Contour3');
Concluzie: