Documente Academic
Documente Profesional
Documente Cultură
al Republicii Moldova
Departamentul Fizica
RAPORT
despre lucrarea de laborator Nr. 2
la Mecanică realizată în MATLAB
Chişinău 2019
Scopul lucrării: Însuşirea elementelor de construire a graficelor în sistemul MATLAB.
Mersul lucrării:
Exerciţiul 1:
Descrieţi comenzile de bază pentru construirea graficelor în pachetul MATLAB.
Orizontal, vertical
20 20 -0.4 2.5
0 15 -0.6
2
-20
10 -0.8
-40
-10 -8 -6 -4 -2 0 2 4 6 8 10
graficul functiei f2=-(x. (1/3)) 5 -1 1.5
0
f(x) ambele pe
-1 0 -1.2
1
-2 -5 -1.4
-3
-10 -8 -6 -4 -2 0 2 4 6 8 10 -10 -1.6 0.5
x 10
6 graficul functiei g=((x-1).3 ).*sqrt(x).*(2. x)
3
ambele pe ambele pe
( 2 (
-0.5 f2=-(x. 1/3)) f2=-(x. 1/3))
Oy axa ordonatelor
1.5
-1 2
1
-1.5
0.5
Prezentarea graficelor
-2 1.5
0
Oy axa ordonatelor
-2.5 -0.5
-10 -8 -6 -4 -2 0 2 4 6 8 10 -10 -8 -6 -4 -2 0 2 4 6 8 10
Ox axa absciselor
1
6
x 10 graficul functiei g=((x-1).3 ).*sqrt(x).*(2. x) graficul functiei f2=-(x.( 1/3)) 6
x 10 graficul functiei g=((x-1). 3).*sqrt(x).*(2.x )
2.5 0 2.5
2 2
0.5 -0.5
in ferestre diferite:
1.5 1.5
dreapta sus
-1
1 1
0 -1.5
0.5 0.5
-2
0 0
a) în ferestre diferite
>> x=[-1:0.1:1];
>> f=(x.^3+2.*x.^2+1);
>> g=((x-1).^4);
>> figure(1);
>> plot(x,f,'c:x')
>> figure(2)
>> plot(x,g,'r*--');
>> legend('functia2')
b) Prezentarea graficelor într-o fereastră pe aceleaşi axe:
>> figure(3)
>> plot(x,f,'c:x',x,g,'r*--')
0
graficul functiei f1=2*(x-1)
-20
-40
-10 -8 -6 -4 -2 0 2 4 6 8 10
graficul functiei f2=-(x. (1/3))
g(x)
0
-1
-2
-3
-10 -8 -6 -4 -2 0 2 4 6 8 10
x 10
6 graficul functiei g=((x-1).3).*sqrt(x).*(2. x )
3
f(x) şi g(x) 1
-1
-10 -8 -6 -4 -2 0 2 4 6 8 10
>> figure(4)
>> subplot(3,1,1);
>> plot(x,f,'c:x');
>> subplot(3,1,2);
>> plot(x,g,'r*--')
>> legend('functia2')
>> subplot(3,1,3)
>> plot(x,f,'c:x',x,g,'r*--');
15 -0.6
2
10 -0.8
ambele pe axele 5
0
-1
-1.2
1.5
1
-5 -1.4
>> figure(5)
>> subplot(1,3,3)
>> plot(x,f,'k:x');
>> subplot(1,3,2)
>> plot(x,g,'g:>')
>> legend('functia2')
>> subplot(1,3,1)
>> plot(x,f,'k:x',x,g,'g:>');
c2) Într-o fereastră – fiecare aparte pe axe diferite şi ambele pe aceleaşi axe.
f(x)
graficul functiei f2=-(x. (1/3)) x 10
6
graficele functiei
0 2.5
f1=2*(x-1)
-1 2
-1.5
-2 1.5
Oy axa ordonatelor
-2.5
-10 -8 -6 -4 -2 0 2 4 6 8 10
1
6
x 10 graficul functiei g=((x-1).3 ).*sqrt(x).*(2. x)
2.5
2
0.5
1.5
1
0
0.5
-0.5 -0.5
-10 -8 -6 -4 -2 0 2 4 6 8 10 -10 -5 0 5 10
Ox axa absciselor
g(x)
>> figure(8)
>> subplot(2,2,1)
>> plot(x,f,'k:x');
>> plot(x,g,'g:>');
>> subplot(2,2,[2,4])
>> plot(x,f,'k:x',x,g,'g:>');
f(x) şi g(x)
6
x 10 graficel e functiei
2.5
f1=2*(x-1)
2 f2=-(x. (1/3))
Oy axa ordonatelor
1.5
0.5
-0.5
-10 -8 -6 -4 -2 0 2 4 6 8 10
Ox axa absciselor
2
-0.5
1.5
-1
1
-1.5
0.5
-2
0
-2.5 -0.5
-10 -5 0 5 10 -10 -5 0 5 10
f(x) g(x)
>> figure9)
>> subplot(2,2,[1,2])
>> plot(x,f,'k:x',x,g,'g:>');
>> subplot(2,2,3)
>> plot(x,f,'k:x');
>> subplot(2,2,4)
>> plot(x,g,'g:>');
Metoda Mesh
>> [x,y]=meshgrid(0:0.2:pi,-1:0.1:1);
>> z=((sin(x-2.*y)).^2.*exp(-abs(y)));
>> figure(1)
>> mesh(x,y,z)
Metoda Surf
>> figure(2)
>> surf(x,y,z)
>> figure(3)
>> meshc(x,y,z)
Metoda Surfc
>> figure(4)
>> surfc(x,y,z)
>> figure(5);
>> contour(x,y,z)
Metoda Contourf
>> figure(6)
>> contourf(x,y,z)
>> figure(7)
>> contour3(x,y,z)