フィルターのクリア

How to not hardcode Simulation time

2 ビュー (過去 30 日間)
Shreneek Upadhye
Shreneek Upadhye 2021 年 6 月 14 日
回答済み: Sanchit Trivedi 2021 年 6 月 14 日
MASS = input('Enter mass value = ');
FrictionCoefficient = input('Enter Friction coefficient value = ');
EngineForce = input('Enter Engine Force value = ');
Fwind = input('Enter Fwind value = ');
out= sim('control.slx',0:0.01:120);
figure
hold on
plot(out.tout,out.velocity,'linewidth',2);
grid on
xlabel('time in s')
ylabel('velocity in m/s')
this is my code how can i make is softcode like mass,FrictionCofficent ,I want to make the Simulation time (,0:0.01:120) in soft code like above so that i can put the value in command windows

回答 (1 件)

Sanchit Trivedi
Sanchit Trivedi 2021 年 6 月 14 日
The following code should allow you to softcode the simulation time and input values from the Command Window.
SimEnd = input('Enter Simulation End Time = ');
SimStep = input('Enter Interval = ');
SimTime = 0 : SimStep : SimEnd
out = sim('control.slx',SimTime);

カテゴリ

Help Center および File ExchangeBiological Physics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by