Using a changing variable within a while loop for a script

7 次查看(过去 30 天)
Hi all,
I have created a script, 'Gear_Optimisation', That can use gear values tpo determine a veicles acceleration, velocity etc over a given distnace.
I know what to change the gear ratios and note the effect. I could do this manually but there are 10 billion combinations so could take a while.
Variable FD is a 3 row vector, Gear_1 5 row, Gear_2 19 Row and Gear_3 to Gear_6 44 row vectors.
Is there a way i can go through each value effectively?
Sorry if this seems a basic question or isn't possible
Thanks in advance
load('Gear_Ratios.mat')
Transmission_efficiency=0.92;
while
Final_Drive=FD;
First=Gear_1;
Second=Gear_2;
Third=Gear_3;
Fourth=Gear_4;
Fifth=Gear_5;
Sixth=Gear_6;
Gear_Optimisation
end
  1 个评论
Alan Weiss
Alan Weiss 2017-4-13
Sorry, I do not understand what you are trying to do. Are you trying to determine at what time to change each gear in order to have the lowest time past a certain marker, or to have the vehicle reach a certain speed the soonest or some such optimization problem?
In any case, discrete problems are usually difficult to solve unless they can be formulated as an MILP (linear objective and constraints), or unless there is a lot of structure to the problem.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Control Design 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by