![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1187793/image.png)
Gear shifting scenario to overcome all resistance forces with using switch
2 次查看(过去 30 天)
显示 更早的评论
My input is the driving cycle and my outputs are engine efficiency and consumption maps. I should be able to change my gears according to the velocity information inside the driving cycle with using switch more than 1. How can i add more than 2 gears with switch into the system? (5-gear transmission vehicle with ig1-2-3-4-5) Or i can prepare the same system in matlab code instead of simulink how can i do that? The system that i tried to do is in the picture but i don' think it's working properly.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1184318/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1184318/image.png)
0 个评论
采纳的回答
Geetla Sindhu
2022-11-10
Hello Batuhan,
I understand that you are using velocity information to change the gears accordingly.
You can use the MATLAB Function block as an alternative for the switches.
You can try this example considering the output as the gear number:
Here the input signal (in your case, it is velocity signal) is considered to be Repeating Sequence with ‘Time values’ = [0 2] and ‘Output values’ = [0 2].
function y = fcn(u)
if (u<0.5)
y=1;
elseif (u>=0.5 && u<0.75)
y=2;
elseif (u>=0.75 && u<1)
y=3;
elseif (u>=1 && u<1.5)
y=4;
else
y=5;
end
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1187793/image.png)
The image shown above gives the gear number (output) with changing velocity (input).
Thank you.
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!