Documente Academic
Documente Profesional
Documente Cultură
al Republicii Moldova
RAPORT
despre lucrarea de laborator Nr. 2
la Mecanică realizată în MATLAB
Chişinău –20__
Sarcina Lucrării nr. 2
2
Conținutul programului:
3
a) 1.
>> x=[-1:0.05:1];
>> f=x.*x;
>> g=x.*x.*x.*x;
>> plot(x,f,'r*:');
>> title('Graficul functiei f(x)');
>> xlabel('Axa x');
>> ylabel('Axa y');
>> legend('f(x)');
a) 2.
>> plot(x,g,'b.--');
>> title('Graficul functiei g(x)')
>> xlabel('Axa x');
>> ylabel('Axa y');
>> legend('g(x)');
4
b)
>> plot(x,f,'r*:',x,g,'b.--');
>> title('Graficele functiilor f(x) si g(x)');
>> xlabel('Axa x');
>> ylabel('Axa y');
>> legend('f(x)','g(x)');
c) 1.1
5
>> subplot(3,1,1)
>> plot(x,f,'r*:');
>> title('Graficul functiei f(x)');
>> xlabel('x');
>> ylabel('y');
>> legend('f(x)');
>> subplot(3,1,2)
>> plot(x,g,'b.--');
>> title('Graficul functiei g(x)');
>> xlabel('x');
>> ylabel('y');
>> legend('g(x)');
>> subplot(3,1,3)
>> plot(x,f,'r*:',x,g,'b.--');
>> xlabel('x');
>> ylabel('y');
>> legend('f(x)','g(x)');
c) 1.2
>> subplot(1,3,1)
>> plot(x,f,'r*:');
>> legend('f(x)');
>> subplot(1,3,2)
>> plot(x,g,'b.--');
6
>> legend('g(x)');
>> subplot(1,3,3)
>> plot(x,f,'r*:',x,g,'b.--');
>> legend('f(x)','g(x)');
c) 2.1
>> subplot(2,2,1)
>> plot(x,f,'r*:');
>> legend('f(x)');
>> subplot(1,2,2)
>> plot(x,f,'r*:',x,g,'b.--');
>> legend('f(x)','g(x)');
>> subplot(2,2,3)
>> plot(x,g,'b.--');
>> legend('g(x)');
7
c). 2.2
>> subplot(2,1,1)
>> plot(x,f,'r*:',x,g,'b.--');
>> legend('f(x)','g(x)');
>> subplot(2,2,3)
>> plot(x,f,'r*:');
>> legend('f(x)');
>> subplot(2,2,4)
>> plot(x,g,'b.--');
>> legend('g(x)');
8
1) Functia grafica – mesh
>> [x,y]=meshgrid(-2:0.05:2,-3:0.05:3);
>> z=exp(-abs(x)).*(x.^5+y.^4).*sin(x.*y);
>> figure(1);
>> mesh(x,y,z);
>> title('Mesh');
9
3) Functia grafica – meshc
>> figure(3);
>> meshc(x,y,z);
>> title('Meshc');
10
4) Functia grafica – surfc
>> figure(4);
>> surfc(x,y,z);
>> title('Surfc');
11
6) Functia grafica – contourf
>> figure(6);
>> contourf(x,y,z);
>> title('Contourf');
7) Contour3
>> figure(7);
>> contour3(x,y,z);
>> title('Contour3');
12
Concluzie:
După ce am elaborat această lucrare am însușit sintaxa sistemului MATLAB, am
însușit comenzile de bază a acestui sistem iar aceste comenzi au fost utilizate cu succes
în elaborarea condiției propuse. A fost studiat și procesul de lucru cu matricele și
vectorii, comenzile de manipulare ale acestora cât și aplicarea lor în practică.
13