Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

1a

function dudt=functie(t,u);
m=0.5;
x=u(1);
y=(2);
xp=u(3);
yp=u(4);
F1x=2;
F1y=-1.5*y;
F2x=cos(x);
F2y=sin(y);
xpp=(F1x+F2x)/m;
ypp=(F1y+F2y)/m;
dudt=[xp;yp;xpp;ypp];

clear all; close all;


v0=1;
alpha=pi/4;
x0=0;
y0=0;
v0x=v0*cos(alpha);
v0y=v0*sin(alpha);
u0=[x0,y0,v0x,v0y];
tmin=0;
tmax=10;
t=[tmin,tmax];
[t,u]= ode45('functie',t,u0);
figure(1);
x=u(:,1);
y=u(:,2);
vx=u(:,3);
vy=u(:,4);
plot(t,x,t,y);
grid on;
title('Graficul dependentelor x=x(t), y=y(t)');
xlabel('t');
ylabel('pozitia');

Graficul dependentelor x=x(t), y=y(t)


250

200

150

100

50
pozitia

-50

-100

-150

-200

-250
0 1 2 3 4 5 6 7 8 9 10
t
1b)
clear all; close all;
v0=1;
alpha=pi/4;
x0=0;
y0=0;
v0x=v0*cos(alpha);
v0y=v0*sin(alpha);
u0=[x0,y0,v0x,v0y];
tmin=0;
tmax=10;
t=[tmin,tmax];
[t,u]= ode45('functie',t,u0);
figure(1);
x=u(:,1);
y=u(:,2);
vx=u(:,3);
vy=u(:,4);
plot(t,x,t,y);
grid on;
title('Graficul dependentelor x=x(t), y=y(t)');
xlabel('t');
ylabel('pozitia');
figure(2);
v=sqrt(vx.^2+vy.^2);
plot(t,vx,t,vy,t,v);
grid on;
title('Graficul dependentelor vx(t), vy(t), v(t)');
xlabel('t');
ylabel('viteza');

Graficul dependentelor vx(t), vy(t), v(t)


60

40

20
viteza

-20

-40

-60
0 1 2 3 4 5 6 7 8 9 10
t
1c)
clear all; close all;
v0=1;
alpha=pi/4;
x0=0;
y0=0;
v0x=v0*cos(alpha);
v0y=v0*sin(alpha);
u0=[x0,y0,v0x,v0y];
tmin=0;
tmax=10;
t=[tmin,tmax];
[t,u]= ode45('functie',t,u0);
figure(1);
x=u(:,1);
y=u(:,2);
vx=u(:,3);
vy=u(:,4);
plot(t,x,t,y);
grid on;
title('Graficul dependentelor x=x(t), y=y(t)');
xlabel('t');
ylabel('pozitia');
figure(2);
v=sqrt(vx.^2+vy.^2);
plot(t,vx,t,vy,t,v);
grid on;
title('Graficul dependentelor vx(t), vy(t), v(t)');
xlabel('t');
ylabel('viteza');
figure(3);
plot(x,y);
hold on;
quiver(x0,y0,v0x*30,v0y*30);
grid on;
title('Traiectoria punctului material');
xlabel('axa x');
ylabel('axa y');

Traiectoria punctului material


50

-50
axa y

-100

-150

-200

-250
0 50 100 150 200 250
axa x

2a)
function dudt=functie(t,u);
m=0.5;
c=0.2;
x=u(1);
y=(2);
z=(3);
xp=u(4);
yp=u(5);
zp=u(6);
Px=-0.5*xp;
Py=0;
Pz=zp;
Rx=-c*xp;
Ry=-c*yp;
Rz=-c*zp;
xpp=(Px+Rx)/m;
ypp=(Py+Ry)/m;
zpp=(Pz+Rz)/m;
dudt=[xp;yp;zp;xpp;ypp;zpp];

clear all; close all;


v0x=2;
v0y=2;
v0z=0;
x0=0;
y0=0;
z0=0;
tmin=0;
tmax=10;
t=[tmin,tmax];
u0=[x0,y0,z0,v0x,v0y,v0z];
[t,u]= ode45('functie',t,u0);
figure(4);
x=u(:,1);
y=u(:,2);
z=u(:,3);
vx=u(:,4);
vy=u(:,5);
vz=u(:,6);
plot(t,x,t,y,t,z);
grid on;
title('Graficele dependen?elor x = x(t), y = y(t) z = z(t)');
xlabel('t');
ylabel('pozitia');
Graficele dependen?elor x = x(t), y = y(t) z = z(t)

4.5

3.5

3
pozitia

2.5

1.5

0.5

0
0 1 2 3 4 5 6 7 8 9
t

2b)
clear all; close all;
v0x=2;
v0y=2;
v0z=0;
x0=0;
y0=0;
z0=0;
tmin=0;
tmax=10;
t=[tmin,tmax];
u0=[x0,y0,z0,v0x,v0y,v0z];
[t,u]= ode45('functie',t,u0);
figure(4);
x=u(:,1);
y=u(:,2);
z=u(:,3);
vx=u(:,4);
vy=u(:,5);
vz=u(:,6);
plot(t,x,t,y,t,z);
grid on;
title('Graficele dependen?elor x = x(t), y = y(t) z = z(t)');
xlabel('t');
ylabel('pozitia');
figure(5);
plot3(x,y,z);
hold on;
quiver3(x0,y0,z0,v0x,v0y,v0z);
grid on;
title('Traiectoria miscarii punctului material');
xlabel('axa x');
ylabel('axa y');
zlabel('axa z');

Traiectoria miscarii punctului material

0.5
axa z

-0.5

-1
6
2
4
1.5
2 1
0.5
axa y 0 0 axa x

You might also like