-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHW1codeA.m
64 lines (51 loc) · 1.36 KB
/
HW1codeA.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
% HW1 (a) BANSEOK LEE
clear all
options=odeset('RelTol',1e-4,'Refine',5);
simtime=[0 4000];
xinit=[0;0;0;0;0;0;0;0;0];
[t,x]=ode45(@ahf,simtime,xinit);
[t2,x2]=ode45(@ahf2,simtime,xinit);
[t3,x3]=ode45(@ahf3,simtime,xinit);
[t4,x4]=ode45(@ahf4,simtime,xinit);
[t5,x5]=ode45(@ahf5,simtime,xinit);
[t6,x6]=ode45(@ahf6,simtime,xinit);
figure(1)
subplot(411)
plot(t/1000,x(:,1));
hold on;
plot(t/1000,x(:,4));
plot(t/1000,x(:,7));
title('sigma = 1.50'); xlabel('Time(s)'); ylabel('v_i');
subplot(412)
plot(t2/1000,x2(:,1));
hold on;
plot(t2/1000,x2(:,4));
plot(t2/1000,x2(:,7));
title('sigma = 1.89'); xlabel('Time(s)'); ylabel('v_i');
subplot(413)
plot(t3/1000,x3(:,1));
hold on;
plot(t3/1000,x3(:,4));
plot(t3/1000,x3(:,7));
title('sigma = 1.90'); xlabel('Time(s)'); ylabel('v_i');
subplot(414)
plot(t4/1000,x4(:,1));
hold on;
plot(t4/1000,x4(:,4));
plot(t4/1000,x4(:,7));
title('sigma = 2.00'); xlabel('Time(s)'); ylabel('v_i');
figure(2)
subplot(211)
plot(t5/1000,x5(:,1));
hold on;
plot(t5/1000,x5(:,4));
plot(t5/1000,x5(:,7));
title('sigma = 2.00 / +3 Impulse applied u1 at 3.3sec')
xlabel('Time(s)'); ylabel('v_i');
subplot(212)
plot(t6/1000,x6(:,1));
hold on;
plot(t6/1000,x6(:,4));
plot(t6/1000,x6(:,7));
title('sigma = 2.00 / +0.3 Impulse applied u1 at 3.3sec')
xlabel('Time(s)'); ylabel('v_i');