How to give input from matlab (mfile) to simulink model
2 次查看(过去 30 天)
显示 更早的评论
Hi everyone! I am using simulink model in mfile. The model requires an input, I know about the commands sim and simset. Can anyone guide me the syntax to give input. The piece of code which I am using is:
clc
clear all
close all
Kp=18; %system parameters
Ki=12; %system parameters
Kd=54; %system parameters
Tstop=1;
myinput=10 %input to my model
sim('pidtry',Tstop)
figure
plot(simout2)
0 个评论
采纳的回答
Muruganandham Subramanian
2012-12-4
you can do this by creating variable 'myinput' as constant block in simulink model
1 个评论
TAB
2012-12-4
Take a Constant block in model and put myinput in Value field. Constant block will read the variable myinput from base workspace.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Programmatic Model Editing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!