Documente Academic
Documente Profesional
Documente Cultură
Raport
Despre lucrarea de laborator nr.2
Varianta 14
Chișinău 2022
This study source was downloaded by 100000861258917 from CourseHero.com on 02-13-2023 02:05:02 GMT -06:00
https://www.coursehero.com/file/139940729/laborator-2-Mecanicadocx/
1. Descrieți comenzile de bază pentru construirea graficelor în
pachetul Octave.
Rezolvare:
a) În ferestre diferite:
>> x=[-pi:1:4*pi];
>> f = x.*sin(x.^2);
>> plot(x,f,'bd:');
>> title('Graficul functiei f(x)')
This study
>>source was downloaded
xlabel('Axa x') by 100000861258917 from CourseHero.com on 02-13-2023 02:05:02 GMT -06:00
>> ylabel('Axa y')
>> legend('f(x) = xsinx^2')
https://www.coursehero.com/file/139940729/laborator-2-Mecanicadocx/
>> x=[-pi:1:4*pi];
>> g = x.^2.*cos(x);
>> plot(x,g,'r.-');
>> title('Graficul functiei g(x)')
>> xlabel('Axa x')
>> ylabel('Axa y')
>> legend('g(x) = x^2cosx')
>> x=[-pi:1:4*pi];
>> f = x.*sin(x.^2);
>> g = x.^2.*cos(x);
>> hold on
>> plot(x,f,'k:');
>> plot(x,g,'g-.:');
>> title('Graficele functiilor f(x) si g(x)')
>> xlabel('Axa x')
>> ylabel('Axa y')
>> legend('f(x) = xsinx^2','g(x) = x^2cosx')
This study source was downloaded by 100000861258917 from CourseHero.com on 02-13-2023 02:05:02 GMT -06:00
https://www.coursehero.com/file/139940729/laborator-2-Mecanicadocx/
c) Folosind comanda subplot
>> figure(1)
>> subplot(3,1,1);
>> plot(x,f,'r-')
>> title('Graficul fuctiei f(x)')
>> xlabel('Axa x')
>> ylabel('Axa y')
>> subplot(3,1,2);
>> plot(x,g,'k--')
>> title('Graficul fuctiei g(x)')
>> xlabel('Axa x')
>> ylabel('Axa y')
>> subplot(3,1,3);
>> hold on
>> plot(x,f,'r-')
>> plot(x,g,'k--')
>> title('Graficele fuctiilor f(x) si g(x)')
>> xlabel('Axa x')
>> ylabel('Axa y')
>> legend('f(x) = xsinx^2','g(x) = x^2cosx')
This study source was downloaded by 100000861258917 from CourseHero.com on 02-13-2023 02:05:02 GMT -06:00
https://www.coursehero.com/file/139940729/laborator-2-Mecanicadocx/
2) vertical ambele pe axele din dreapta
>> figure(2)
>> subplot(1,3,1);
>> plot(x,f,'m*-')
>> title('Graficul functiei f(x)')
>> xlabel('Axa x')
>> ylabel('Axa y')
>> subplot(1,3,2);
>> plot(x,g,'r.--')
>> title('Graficul functiei g(x)')
>> xlabel('Axa x')
>> ylabel('Axa y')
>> subplot(1,3,3);
>> hold on
>> plot(x,f,'m*-')
>> plot(x,g,'r.--')
>> title('Graficele functiilor f(x) si g(x)')
>> xlabel('Axa x')
>> ylabel('Axa y')
>> legend('f(x) = xsinx^2','g(x) = x^2cosx')
c2) într-o fereastră – fiecare aparte pe axe diferite și ambele pe aceeași axă.
>> figure(4)
>> subplot(2,2,3)
>> plot(x,f,'r-.')
>> title('Graficul functiei f(x)')
>> xlabel('Axa x')
>> ylabel('Axa y')
>> subplot(2,2,4)
>> plot(x,g,'ko--')
>> title('Graficul functiei g(x)')
>> xlabel('Axa x')
>> ylabel('Axa y')
>> subplot(2,2,[1,2])
>> hold on
>> plot(x,f,'r-.')
>> plot(x,g,'ko--')
>> title('Graficele functiilor f(x) si g(x)')
>> xlabel('Axa x')
>> ylabel('Axa y')
>> legend('f(x) = xsinx^2','g(x) = x^2cosx')
This study source was downloaded by 100000861258917 from CourseHero.com on 02-13-2023 02:05:02 GMT -06:00
https://www.coursehero.com/file/139940729/laborator-2-Mecanicadocx/
3. 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.
https://www.coursehero.com/file/139940729/laborator-2-Mecanicadocx/
4. Functia surfc >>
figure(1)
>> [x,y]=meshgrid(-pi:0.1:pi,-1:0.1:1); >>
z = 2.*x.*sin(x.*y).*log10(y+2); >>
surfc(x,y,z)
4. Concluzii
În cadrul lucrării de laborator nr. 2, am luat cunoștință
cu comenzile de bază în construire graficelor în programul Octave.
Am construit diferite tipuri de grafice, spre
exemplu grafice de una și de două variabile. Multitudinea de tipuri de linii, culori
și marchere a făcut posibilă realizararea lucrării într-un
mod mult mai interesant și clar, pentru că folosirea acestora a oferit
claritate funcțiilor pe care le-am reprezentat. Am reprezentat graficele pe aceeași
axă, pe axe diferite, în ferestre diferite, iar mai apoi în
aceeași fereastră cu ajutorul funcției ’’subplot’’.
Consider programul Octave foarte util pentru
reprezentarea funcțiilor matematice, datorită opțiunilor pe care le posedă.
This study source was downloaded by 100000861258917 from CourseHero.com on 02-13-2023 02:05:02 GMT -06:00
https://www.coursehero.com/file/139940729/laborator-2-Mecanicadocx/