Problem fonction while in Simulink
信息
此问题已关闭。 请重新打开它进行编辑或回答。
显示 更早的评论
Hello i'm student and i need to programm the speed of a motor for calculate a battery's autonomy. My motor need to accelerate in first time(to pass 20km/h at 50 mk/h), to stay during 4 sec at 50 km/h, to decelerate to 20 km/h in third time, and for finish to stay during 4 sec at 20km/h. But i don't arrive to simule this in a programm and repeat it until my battery's autonmy pass under 0.2 (20%). If you can help me, i test to do this in matlab function (Simulink)
function u = fonc(a,b,c,d,e)
%u=motor speed
%a=50 km/h
%b=20 km/h
%c=braking time
%d=clock
%e=pourcent of my battery
a=a/3.6/0.2032; %rad/s
b=b/3.6/0.2032; %rad/s
f=(a-b)/c;
while e>0.2
if d<c
u=b+(f*d);
end
if u>a
u=a;
end
if d>8
u=a-(f*(d-8);
end
if u<b
u=b;
end
end
0 个评论
回答(1 个)
此问题已关闭。
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!