Documente Academic
Documente Profesional
Documente Cultură
al Republicii Moldova
RAPORT
Despre lucrarea de laborator Nr.2
la Mecanică realizată în MATLAB
A verificat: Silvia A.
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:
f(x)
graficul functiei f1=2*(x-1)
20 20 -0.4 2.5
0 15 -0.6
ambele pe
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
g(x)
0
-1 0 -1.2
1
axele din
-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
f(x) şi g(x)
2 -15 -1.8
0
1
-20 -2
dreapta
0
c2) într-o fereastră – fiecare aparte pe axe diferite şi ambele pe aceleaşi axe.
a)
graficul functiei f2=-(x. (1/3)) x 10
6 graficele functiei 6
x 10 graficele functiei
0 2.5 2.5
ambele pe ambele pe
f1=2*(x-1) f1=2*(x-1)
f2=-(x. (1/3)) 2 f2=-(x.( 1/3))
-0.5
Oy axa ordonatelor
1.5
-1 2
1
-1.5
0.5
Prezentarea graficelor
-2 1.5
0
-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
-2
0 0
a) în ferestre diferite
x=[-pi:0.05:2*pi];
f=sin(x).^3;
plot(x,f,'k * -');
xlabel('Axa abciselor');
ylabel('Axa coordonatelor');
legend('f(x)');
x=[-pi:0.05:2*pi];
g=cos(x).^3;
plot(x,g,'g . -');
title('Graficul functiei g(x)');
xlabel('Axa abciselor');
ylabel('Axa coordonatelor');
legend('g(x)');
b)Prezentarea graficelor într-o fereastră pe aceleaşi axe:
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
-1
-10 -8 -6 -4 -2 0 2 4 6 8 10
f(x) şi g(x)
subplot(3,1,1);
x=[-pi:0.05:2*pi];
f=sin(x).^3;
plot(x,f,'k * -');
title('Graficul functiei f(x)');
xlabel('Axa abciselor');
ylabel('Axa coordonatelor');
legend('f(x)');
subplot(3,1,2);
x=[-pi:0.05:2*pi];
g=cos(x).^3;
plot(x,g,'g . -');
title('Graficul functiei g(x)');
xlabel('Axa abciselor');
ylabel('Axa coordonatelor');
legend('g(x)');
subplot(3,1,3);
plot(x,f,'k * --',x,g,'g . -');
title('Graficul functiei f(x) si g(x)');
xlabel('Axa abciselor');
ylabel('Axa coordonatelor');
legend('f(x)','g(x)');
f(x) g(x) f(x) şi g(x)
Vertical 20
graficul functiei f1=2*(x-1)
-0.4
graficul functiei f2=-(x .( 1/3)) graficul
2.5
6
functiei
x 10 g=((x-1).3).*sqrt(x).*(2.x )
15 -0.6
2
10 -0.8
ambele pe axele 5
0
-1
-1.2
1.5
1
-5 -1.4
din dreapta
-15 -1.8
0
-20 -2
x=[-pi:0.05:2*pi];
f=sin(x).^3;
g=cos(x).^3;
subplot(1,3,1);
plot(x,f,'gx:');
title('Graficul functiei f');
xlabel('Axa x');
ylabel('Axa y');
legend('Functia 1');
subplot(1,3,2);
plot(x,g,'b^-.');
title('Graficul functiei g');
xlabel('Axa x');
ylabel('Axa y');
legend('Functia 2');
subplot(1,3,3);
hold on;
plot(x,f,'gx:');
plot(x,g,'b^-.');
xlabel('Axa x');
ylabel('Axa y');
title('Graficul functiilor f si g');
legend('Functia 1','Functia 2')
de aici de continuat
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)
subplot(2,2,1);
x=[-pi:0.05:2*pi];
f=sin(x).^3;
plot(x,f,'k * -');
title('Graficul functiei f(x)');
xlabel('Axa abciselor');
ylabel('Axa coordonatelor');
legend('f(x)');
x=[-pi:0.05:2*pi];
f=sin(x).^3;
plot(x,f,'k * -');
title('Graficul functiei f(x)');
xlabel('Axa abciselor');
ylabel('Axa coordonatelor');
legend('f(x)');
subplot(2,2,3)
x=[-pi:0.05:2*pi];
g=cos(x).^3;
plot(x,g,'g . -');
title('Graficul functiei g(x)');
xlabel('Axa abciselor');
ylabel('Axa coordonatelor');
legend('g(x)');
subplot(1,2,2)
plot(x,f,'k * --',x,g,'g . -');
title('Graficul functiei f(x) si g(x)');
xlabel('Axa abciselor');
ylabel('Axa coordonatelor');
legend('f(x)','g(x)');
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)
subplot(2,1,1)
plot(x,f,'k * --',x,g,'g . -');
title('Graficul functiei f(x) si g(x)');
xlabel('Axa abciselor');
ylabel('Axa coordonatelor');
legend('f(x)','g(x)');
subplot(2,2,3)
x=[-pi:0.05:2*pi];
g=cos(x).^3;
plot(x,g,'g . -');
title('Graficul functiei g(x)');
xlabel('Axa abciselor');
ylabel('Axa coordonatelor');
legend('g(x)');
subplot(2,2,4)
x=[-pi:0.05:2*pi];
f=sin(x).^3;
plot(x,f,'k * -');
title('Graficul functiei f(x)');
xlabel('Axa abciselor');
ylabel('Axa coordonatelor');
legend('f(x)');
Exerciţiul 3:
Metoda Mesh
figure(1)
[x,y]=meshgrid(-1:0.05:2,-2:0.05:3);
z=exp(-abs(x)).*(x.^2+y.^2).*cos(x.*y);
mesh(x,y,z)
title('mesh');
Metoda Surf
figure(2)
[x,y]=meshgrid(-1:0.05:2,-2:0.05:3);
z=exp(-abs(x)).*(x.^2+y.^2).*cos(x.*y);
surf(x,y,z);
title('Surf');
Metoda Meshc
figure(3)
[x,y]=meshgrid(-1:0.05:2,-2:0.05:3);
z=exp(-abs(x)).*(x.^2+y.^2).*cos(x.*y);
meshc(x,y,z);
title('Meshc');
Metoda Surfc
figure(4)
[x,y]=meshgrid(-1:0.05:2,-2:0.05:3);
z=exp(-abs(x)).*(x.^2+y.^2).*cos(x.*y);
surfc(x,y,z);
title('Sufc');
Metoda Contour
figure(5)
[x,y]=meshgrid(-1:0.05:2,-2:0.05:3);
z=exp(-abs(x)).*(x.^2+y.^2).*cos(x.*y);
contour(x,y,z);
title('Contour');
Metoda Contourf
figure(6)
[x,y]=meshgrid(-1:0.05:2,-2:0.05:3);
z=exp(-abs(x)).*(x.^2+y.^2).*cos(x.*y);
contourf(x,y,z);
title('Contourf');
Metoda Contour3
figure(7)
[x,y]=meshgrid(-1:0.05:2,-2:0.05:3);
z=exp(-abs(x)).*(x.^2+y.^2).*cos(x.*y);
contour3(x,y,z);
title('Contour3');
Concluzie: