点击下方卡片,加入会员全年无限制学习后台(MPC各矩阵的底层逻辑、MPC纵向控制、模型验证、MPC自适应巡航控制、非线性系统如何线性化及MPC动力学跟踪任何轨迹、约束添加及新求解器的求解、轨迹规划、纵向规划等80个系列)会员专享爆品课程及资源,同时获得分佣资格,可赚回自己的学费!
shape=2.4;%参数名称,用于参考轨迹生成
dx1=25;dx2=21.95;%没有任何实际意义,只是参数名称
dy1=4.05;dy2=5.7;%没有任何实际意义,只是参数名称
Xs1=27.19;Xs2=56.46;%参数名称
% X_phi=1:1:200;%这个点的区间是根据纵向速度(x_dot)来定的,如果速度为20m/s,采样时间0.05,则区间=20*0.05=1;跑Tsim=10秒
% X_phi=1:0.5:200;%这个点的区间是根据纵向速度(x_dot)来定的,如果速度为10m/s采样时间0.05;则区间=10*0.05=0.5;跑Tsim=20秒
X_phi=1:1:100;%这个点的区间是根据纵向速度(x_dot)来定的,如果速度为10m/s则区间=10*0.1=1;跑Tsim=10秒
z1=shape/dx1*(X_phi-Xs1)-shape/2;
z2=shape/dx2*(X_phi-Xs2)-shape/2;
Y_ref=dy1/2.*(1+tanh(z1))-dy2/2.*(1+tanh(z2));
figure(1);
plot(X_phi, Y_ref,'r--','LineWidth',2);
hold on
a=[X_phi',Y_ref'];%对比之后发现图像结果是一样的。通过调整速度,采样时间及总的仿真时间。
如果速度为10m/s,则区间跨度=10*0.1=1;跑Tsim=10秒,总路程为100.
1 0.00240183968615492
2 0.00290978061905239
3 0.00352504403322333
4 0.00427026140720779
5 0.00517281591200281
6 0.00626583044512652
7 0.00758935661616248
8 0.00919180344709441
9 0.0111316510268701
10 0.0134795014234211
11 0.0163205265850862
12 0.0197573803393429
13 0.0239136482079198
14 0.0289379134574729
15 0.0350085188221620
16 0.0423390980153212
17 0.0511849356299217
18 0.0618501828426385
19 0.0746959019664849
20 0.0901488253615645
21 0.108710580837580
22 0.130966941336505
23 0.157596384992649
24 0.189376887942811
25 0.227189409240833
26 0.272015974891625
27 0.324929668513329
28 0.387073283806291
29 0.459623057492939
30 0.543734039407989
31 0.640464610749948
32 0.750679802445566
33 0.874936663243314
34 1.01335993895085
35 1.16552213729121
36 1.33034730007094
37 1.50606044850681
38 1.69020253792924
39 1.87972253877518
40 2.07114457505686
41 2.26079196650103
42 2.44503635747057
43 2.62053357305940
44 2.78441081355328
45 2.93438117599871
46 3.06877723204681
47 3.18651046817110
48 3.28697393840182
49 3.36990997151822
50 3.43526394667119
51 3.48304103828739
52 3.51317768201620
53 3.52543506280846
54 3.51931913900729
55 3.49403086259931
56 3.44845109714760
57 3.38116666342808
58 3.29054600816579
59 3.17487384622588
60 3.03255200552132
61 2.86236663243337
62 2.66380838917127
63 2.43741253413379
64 2.18506340403621
65 1.91019066256979
66 1.61778353739271
67 1.31417317777350
68 1.00658265105880
69 0.702506107257198
70 0.409029990364433
71 0.132227390491831
72 -0.123266762554337
73 -0.354446111958895
74 -0.559896852371121
75 -0.739589677647373
76 -0.894574378612028
77 -1.02664777854216
78 -1.13804705779870
79 -1.23119782549220
80 -1.30852683928084
81 -1.37233612107906
82 -1.42472831505128
83 -1.46757092560748
84 -1.50248771359626
85 -1.53086751641229
86 -1.55388310466931
87 -1.57251485828871
88 -1.58757581535111
89 -1.59973597768331
90 -1.60954469639962
91 -1.61745058818194
92 -1.62381882972159
93 -1.62894591230286
94 -1.63307206440679
95 -1.63639160641843
96 -1.63906151517009
97 -1.64120846533032
98 -1.64293459130779
99 -1.64432218469498
100 -1.64543751267049
如果速度为20m/s,则区间跨度=20*0.05=1;跑Tsim=10秒,总路程为200
1 0.00240183968615492
2 0.00290978061905239
3 0.00352504403322333
4 0.00427026140720779
5 0.00517281591200281
6 0.00626583044512652
7 0.00758935661616248
8 0.00919180344709441
9 0.0111316510268701
10 0.0134795014234211
11 0.0163205265850862
12 0.0197573803393429
13 0.0239136482079198
14 0.0289379134574729
15 0.0350085188221620
16 0.0423390980153212
17 0.0511849356299217
18 0.0618501828426385
19 0.0746959019664849
20 0.0901488253615645
21 0.108710580837580
22 0.130966941336505
23 0.157596384992649
24 0.189376887942811
25 0.227189409240833
26 0.272015974891625
27 0.324929668513329
28 0.387073283806291
29 0.459623057492939
30 0.543734039407989
31 0.640464610749948
32 0.750679802445566
33 0.874936663243314
34 1.01335993895085
35 1.16552213729121
36 1.33034730007094
37 1.50606044850681
38 1.69020253792924
39 1.87972253877518
40 2.07114457505686
41 2.26079196650103
42 2.44503635747057
43 2.62053357305940
44 2.78441081355328
45 2.93438117599871
46 3.06877723204681
47 3.18651046817110
48 3.28697393840182
49 3.36990997151822
50 3.43526394667119
51 3.48304103828739
52 3.51317768201620
53 3.52543506280846
54 3.51931913900729
55 3.49403086259931
56 3.44845109714760
57 3.38116666342808
58 3.29054600816579
59 3.17487384622588
60 3.03255200552132
61 2.86236663243337
62 2.66380838917127
63 2.43741253413379
64 2.18506340403621
65 1.91019066256979
66 1.61778353739271
67 1.31417317777350
68 1.00658265105880
69 0.702506107257198
70 0.409029990364433
71 0.132227390491831
72 -0.123266762554337
73 -0.354446111958895
74 -0.559896852371121
75 -0.739589677647373
76 -0.894574378612028
77 -1.02664777854216
78 -1.13804705779870
79 -1.23119782549220
80 -1.30852683928084
81 -1.37233612107906
82 -1.42472831505128
83 -1.46757092560748
84 -1.50248771359626
85 -1.53086751641229
86 -1.55388310466931
87 -1.57251485828871
88 -1.58757581535111
89 -1.59973597768331
90 -1.60954469639962
91 -1.61745058818194
92 -1.62381882972159
93 -1.62894591230286
94 -1.63307206440679
95 -1.63639160641843
96 -1.63906151517009
97 -1.64120846533032
98 -1.64293459130779
99 -1.64432218469498
100 -1.64543751267049
101 -1.64633391462912
102 -1.64705430881644
103 -1.64763321837777
104 -1.64809840702615
105 -1.64847219829931
106 -1.64877253880696
107 -1.64901385462765
108 -1.64920774076049
109 -1.64936351595808
110 -1.64948866908468
111 -1.64958921811622
112 -1.64966999882016
113 -1.64973489685095
114 -1.64978703432725
115 -1.64982891980179
116 -1.64986256879564
117 -1.64988960066763
118 -1.64991131646041
119 -1.64992876145609
120 -1.64994277544275
121 -1.64995403310470
122 -1.64996307647603
123 -1.64997034101651
124 -1.64997617656260
125 -1.64998086416064
126 -1.64998462959125
127 -1.64998765423526
128 -1.64999008380359
129 -1.64999203535093
130 -1.64999360291056
131 -1.64999486202131
132 -1.64999587336448
133 -1.64999668568564
134 -1.64999733814199
135 -1.64999786218808
136 -1.64999828309074
137 -1.64999862114613
138 -1.64999889265742
139 -1.64999911072024
140 -1.64999928585357
141 -1.64999942650668
142 -1.64999953946625
143 -1.64999963018343
144 -1.64999970303668
145 -1.64999976154273
146 -1.64999980852618
147 -1.64999984625569
148 -1.64999987655337
149 -1.64999990088265
150 -1.64999992041886
151 -1.64999993610596
152 -1.64999994870206
153 -1.64999995881599
154 -1.64999996693671
155 -1.64999997345688
156 -1.64999997869183
157 -1.64999998289481
158 -1.64999998626915
159 -1.64999998897817
160 -1.64999999115299
161 -1.64999999289889
162 -1.64999999430044
163 -1.64999999542552
164 -1.64999999632863
165 -1.64999999705356
166 -1.64999999763543
167 -1.64999999810246
168 -1.64999999847731
169 -1.64999999877816
170 -1.64999999901960
171 -1.64999999921337
172 -1.64999999936887
173 -1.64999999949365
174 -1.64999999959378
175 -1.64999999967413
176 -1.64999999973860
177 -1.64999999979032
178 -1.64999999983182
179 -1.64999999986511
180 -1.64999999989182
181 -1.64999999991324
182 -1.64999999993043
183 -1.64999999994421
184 -1.64999999995527
185 -1.64999999996414
186 -1.64999999997125
187 -1.64999999997695
188 -1.64999999998152
189 -1.64999999998519
190 -1.64999999998813
191 -1.64999999999049
192 -1.64999999999238
193 -1.64999999999389
194 -1.64999999999511
195 -1.64999999999608
196 -1.64999999999686
197 -1.64999999999748
198 -1.64999999999799
199 -1.64999999999839
200 -1.64999999999871
点击下方卡片,加入会员全年无限制学习后台(MPC各矩阵的底层逻辑、MPC纵向控制、模型验证、MPC自适应巡航控制、非线性系统如何线性化及MPC动力学跟踪任何轨迹、约束添加及新求解器的求解、轨迹规划、纵向规划等80个系列)会员专享爆品课程及资源,同时获得分佣资格,可赚回自己的学费!