How to give input from matlab (mfile) to simulink model

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)

 採用された回答

Muruganandham Subramanian
Muruganandham Subramanian 2012 年 12 月 4 日

0 投票

you can do this by creating variable 'myinput' as constant block in simulink model

1 件のコメント

TAB
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 件)

カテゴリ

ヘルプ センター および File Exchange で Modeling についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by