Skip to content

Commit ddb687b

Browse files
authored
Add files via upload
1 parent 2a885d7 commit ddb687b

File tree

5 files changed

+195
-0
lines changed

5 files changed

+195
-0
lines changed

vectorcal/ps8/MATLAB22.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
x = 0:.01:2;
2+
y = x.^2+(x+1).^-2;
3+
4+
I = trapz(x,y);
5+
I
6+
7+
x = 0:.2:2;
8+
y = x.^2+(x+1).^-2;
9+
I = trapz(x,y);
10+
I

vectorcal/ps8/MATLAB23.m

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
G = 1350;
2+
A = 8;
3+
c = 3*10^8;
4+
5+
% definition of the orbit
6+
t = 0:0.001:pi/2;
7+
8+
% parameters of the ellipse
9+
a = 1.5*10^11;
10+
b = 1.3*10^11;
11+
d= 10^9;
12+
13+
% definition of the parametric curve
14+
x = a*cos(t);
15+
y = b*sin(t);
16+
z= d*cos(t);
17+
18+
% velocity of the spacecraft
19+
velx = gradient(x,0.001);
20+
vely = gradient(y,0.001);
21+
velz= gradient(z,0.001);
22+
23+
% magnitude of the velocity
24+
velmag = sqrt(velx.^2+vely.^2+velz.^2);
25+
26+
% acceleration of the spacecraft
27+
accx = gradient(velx,0.001);
28+
accy = gradient(vely,0.001);
29+
accz = gradient(velz,0.001);
30+
% magnitude of the acceleration
31+
accmag = sqrt(accx.^2+accy.^2+accz.^2);
32+
33+
% magnitude of the force due to solar radiations
34+
f = -1/c*G*A;
35+
36+
% cosine of the angle between the force and the velocity % vector
37+
costheta = (velx.*accx+vely.*accy+velz.*accz)./velmag./accmag;
38+
39+
40+
% computation of the work done for t between 0 and pi
41+
W = trapz(f*velmag.*costheta,t)

vectorcal/ps8/pset8p1a.m

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
C1=3000;
2+
C2=2775;
3+
C3=2545;
4+
5+
n1=3.0;
6+
n2=2.8;
7+
n3=2.6;
8+
9+
cd=.2;
10+
A=2;
11+
g=0:.001:1;
12+
figure
13+
14+
t1=0.1*C1*((g.^(n1-1))/(n1-1) + (g.^(n1+1))/(n1+1));
15+
x1=0.2*C1.^2*((g.^(2*n1-1))/(2*n1-1) + (g.^(2*n1+1))/(2*n1+1));
16+
y1=0.1*C1.^2*((g.^(2*n1-2))/(2*n1-2) + (g.^(2*n1+2))/(2*n1+2));
17+
plot(x1,y1,'r')
18+
hold on
19+
20+
t2=0.1*C2*((g.^(n2-1))/(n2-1) + (g.^(n2+1))/(n2+1));
21+
x2=0.2*C2.^2*((g.^(2*n2-1))/(2*n2-1) + (g.^(2*n2+1))/(2*n2+1));
22+
y2=0.1*C2.^2*((g.^(2*n2-2))/(2*n2-2) + (g.^(2*n2+2))/(2*n2+2));
23+
plot(x2,y2,'g')
24+
hold on
25+
26+
t3=0.1*C3*((g.^(n3-1))/(n3-1) + (g.^(n3+1))/(n3+1));
27+
x3=0.2*C3.^2*((g.^(2*n3-1))/(2*n3-1) + (g.^(2*n3+1))/(2*n3+1));
28+
y3=0.1*C3.^2*((g.^(2*n3-2))/(2*n3-2) + (g.^(2*n3+2))/(2*n3+2));
29+
plot(x3,y3,'b')
30+
hold on
31+
32+
title('different trajectories of launch satellites')
33+
xlabel('horizontal displacement')
34+
ylabel('vertical displacement')
35+
legend('case 1','case 2', 'case 3')
36+
37+
%part1b
38+
39+
figure
40+
velx1 = gradient(x1,g).*gradient(g,t1);
41+
vely1 = gradient(y1,g).*gradient(g,t1);
42+
speed1 = (velx1.^2 + vely1.^2).^.5;
43+
plot(t1,speed1,'g')
44+
ylabel('speed1')
45+
xlabel('time')
46+
47+
hold on
48+
velx2 = gradient(x2,g).*gradient(g,t2);
49+
vely2 = gradient(y2,g).*gradient(g,t2);
50+
speed2 = (velx2.^2 + vely2.^2).^.5;
51+
plot(t2,speed2,'b')
52+
ylabel('speed2')
53+
xlabel('time')
54+
55+
56+
hold on
57+
velx3 = gradient(x3,g).*gradient(g,t3);
58+
vely3 = gradient(y3,g).*gradient(g,t3);
59+
speed3 = (velx3.^2 + vely3.^2).^.5;
60+
plot(t3,speed3,'r')
61+
ylabel('speed')
62+
xlabel('time')
63+
legend('case 1','case 2', 'case 3')
64+
title('speed vs time')
65+
66+
%part 1c
67+
figure
68+
p1=1.2.*exp(-y1./8000);
69+
p2=1.2.*exp(-y2./8000);
70+
p3=1.2.*exp(-y3./8000);
71+
F1 = .5*p1.*speed1.^2*A*cd;
72+
F2 = .5*p2.*speed2.^2*A*cd;
73+
F3 = .5*p3.*speed3.^2*A*cd;
74+
75+
plot(t1,F1,'g')
76+
hold on
77+
plot(t2,F2,'r')
78+
hold on
79+
plot(t3,F3,'b')
80+
xlabel('time')
81+
ylabel('force')
82+
title('drag force vs time')
83+
legend('case 1','case 2','case 3')
84+
85+
%part 1d
86+
87+
work1 = -1*trapz(abs(F1).*speed1,t1)
88+
work2 = -1*trapz(abs(F2).*speed2,t2)
89+
work3 = -1*trapz(abs(F3).*speed3,t3)

vectorcal/ps8/pset8p1b.m

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
subplot(1,3,1)
3+
velx1 = gradient(x1,g).*gradient(g,t1);
4+
vely1 = gradient(y1,g).*gradient(g,t1);
5+
speed1 = (velx1.^2 + vely1.^2).^5;
6+
plot(speed1,t1,'g')
7+
ylabel('speed1')
8+
xlabel('time')
9+
title('case 1 speed vs time')
10+
11+
subplot(1,3,2)
12+
velx2 = gradient(x2,g).*gradient(g,t2);
13+
vely2 = gradient(y2,g).*gradient(g,t2);
14+
speed2 = (velx2.^2 + vely2.^2).^5;
15+
plot(speed2,t2,'b')
16+
ylabel('speed2')
17+
xlabel('time')
18+
title('case 2 speed vs time')
19+
20+
subplot(1,3,3)
21+
velx3 = gradient(x3,g).*gradient(g,t3);
22+
vely3 = gradient(y3,g).*gradient(g,t3);
23+
speed3 = (velx3.^2 + vely3.^2).^5;
24+
plot(speed3,t3,'r')
25+
ylabel('speed3')
26+
xlabel('time')
27+
title('case 3 speed vs time')
28+
29+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
subplot(1,3,1)
2+
velx1 = gradient(x1,g).*gradient(g,t1);
3+
vely1 = gradient(y1,g).*gradient(g,t1);
4+
speed1 = (velx1.^2 + vely1.^2).^5;
5+
plot(t1, speed1,'g')
6+
ylabel('speed1')
7+
xlabel('time')
8+
title('case 1 speed vs time')
9+
10+
subplot(1,3,2)
11+
velx2 = gradient(x2,g).*gradient(g,t2);
12+
vely2 = gradient(y2,g).*gradient(g,t2);
13+
speed2 = (velx2.^2 + vely2.^2).^5;
14+
plot(t2,speed2,'b')
15+
ylabel('speed2')
16+
xlabel('time')
17+
title('case 2 speed vs time')
18+
19+
subplot(1,3,3)
20+
velx3 = gradient(x3,g).*gradient(g,t3);
21+
vely3 = gradient(y3,g).*gradient(g,t3);
22+
speed3 = (velx3.^2 + vely3.^2).^5;
23+
plot(t3,speed3,'r')
24+
ylabel('speed3')
25+
xlabel('time')
26+
title('case 3 speed vs time')

0 commit comments

Comments
 (0)