matlab simulink汽车优化设计遍历法
Posted studyer_domi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了matlab simulink汽车优化设计遍历法相关的知识,希望对你有一定的参考价值。
1、内容简介
略
455-可以交流、咨询、答疑
2、内容说明
略
3、仿真分析
clc
close all
clear
m1 = 55;
m2 = 400;
k1 = 300000;
k2 = 40000;
b2 = 4000;
g = 9.8;
t = 0:0.0001:2;
v = 20;%车速
h = 0.05;
L = 3;
R = (L^2/4+h^2)/2/h;%路面不平顺等效的圆半径
delta = asin(L/2/R);
degre = -delta:0.0001:delta;
x0 = R*sin(degre)+L/2;
y0 = R*cos(degre)-R+h;
figure
plot(x0,y0)
xlabel 水平位移
ylabel 路面不平顺
x = t*v;
y = zeros(1,length(x));
for i = 1:length(x)
if x(i)<L
y(i) = interp1(x0,y0,x(i));
end
end
figure
plot(x,y)
xlabel 水平距离
ylabel 路面不平顺
title 完整路面的路面
simin = [t' y']; %路面数据输入到simulink
sim model1.mdl
figure
plot(tout,yout(:,4))
xlabel 时间/s
ylabel 车体位移/m
fop_init = trapz(tout,abs(yout(:,1))); %vehicle comfort
k_1 = 200000:50000:400000;
k_2 = 30000:5000:50000;
b_2 = 500:500:5000;
temp = [];
for i = 1:length(k_1)
for j = 1:length(k_2)
for m = 1:length(b_2)
k1 = k_1(i);
k2 = k_2(j);
b2 = b_2(m);
sim model1.mdl
fop_1 = trapz(tout,abs(yout(:,1)));
% max(-yout(:,3))*300000<=0.8*(m1+m2)*g
if max(yout(:,2))<=0.08 && max(-yout(:,3))*300000<=0.8*(m1+m2)*g %判断结果是否满足限制条件
aa = 1
if fop_1<fop_init %如果本次结果比上次的值小就更新目标函数值
bb = 1
fop_init = fop_1;
temp = [temp; i j m];
end
end
end
end
end
k11 = 300000;
k21 = 40000;
b21 = 4000;
if isempty(temp)
disp('未能得到最优的结果')
disp(['k1 = ',num2str(k11)])
disp(['k2 = ',num2str(k21)])
disp(['b2 = ',num2str(b21)])
else
disp('优化得到的结果为')
disp(['k1 = ',num2str(k_1(temp(end,1)))])
disp(['k2 = ',num2str(k_2(temp(end,2)))])
disp(['b2 = ',num2str(b_2(temp(end,3)))])
end
4、参考论文
略
以上是关于matlab simulink汽车优化设计遍历法的主要内容,如果未能解决你的问题,请参考以下文章
PID优化基于matlab simulink正余弦算法PID优化设计含Matlab源码 2233期
matlab simulink实现分数阶pid加模糊pid控制的汽车六轮转向