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

조회 수: 3 (최근 30일)
azan
azan 2012년 12월 4일
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일
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개)

카테고리

Help CenterFile Exchange에서 Event Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by