-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass20180118_IT2N2_linear_heart.m
More file actions
84 lines (67 loc) · 1.45 KB
/
class20180118_IT2N2_linear_heart.m
File metadata and controls
84 lines (67 loc) · 1.45 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
clear;
%common parameter
t=[0.0...
1.5 ...
2.5 ...
4.5 ...
5.5];
x=[0.0 ...
1.0 ...
2.0 ...
1.5 ...
0.0];
y=[0.0 ...
1.0 ...
0.2 ...
-1.5 ...
-2.5];
%restrictions for x
Ax=vander(t);%the coordinate value requirements
Ax=Ax(:,end:-1:1);%reverse the order to agree on our formulation
Ax(:,end+1)=[t'].^5;%adding to complete 5th order case
t0=t(3);%at t2...
Ax(end+1,:)=[0 1 2*t0 3*t0^2 4*t0^3 5*t0^4];%...extremity required
bx=[x';0];
%restrictions for y
Ay=vander(t);%the coordinate value requirements
Ay=Ay(:,end:-1:1);%reverse the order to agree on our formulation
Ay(:,end+1)=[t'].^5;%adding to complete 5th order case
t0=t(2);%at t1...
Ay(end+1,:)=[0 1 2*t0 3*t0^2 4*t0^3 5*t0^4];%...extremity required
by=[y';0];
%solving for parameters
px=Ax\bx;
py=Ay\by;
N=10^3;
tplot=linspace(min(t),max(t),N);
xplot=polyval(px(end:-1:1),tplot);
yplot=polyval(py(end:-1:1),tplot);
Xplot=polyval(px(end:-1:1),t);
Yplot=polyval(py(end:-1:1),t);
%plotting
figure(1);
clf;
vert=2;
horz=3;
subplot(vert,horz,[1 2 4 5]);
hold on;
plot(xplot,yplot,'b.-');
plot(-xplot,yplot,'b.-');
plot(Xplot,Yplot,'ro');
grid on;
xlabel('x');
ylabel('y');
subplot(vert,horz,[3]);
hold on;
plot(tplot,xplot,'b.-');
plot(t,Xplot,'ro');
grid on;
xlabel('t');
ylabel('x');
subplot(vert,horz,[6]);
hold on;
plot(tplot,yplot,'b.-');
plot(t,Yplot,'ro');
grid on;
xlabel('t');
ylabel('y');