Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: how to control my input using a code in simulink modeling
Date: Mon, 9 Nov 2009 09:41:24 -0000
Organization: The MathWorks, Inc.
Lines: 30
Message-ID: <hd8o45$gdp$1@fred.mathworks.com>
References: <hd5j2t$28l$1@fred.mathworks.com>
NNTP-Posting-Host: uk-mieegea.mathworks.co.uk
X-Trace: fred.mathworks.com 1257759685 16825 172.16.27.185 (9 Nov 2009 09:41:25 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 9 Nov 2009 09:41:25 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
Xref: news.mathworks.com comp.soft-sys.matlab:583498



"Ela " <elahetale@yahoo.com> wrote in message 
news:hd5j2t$28l$1@fred.mathworks.com...
> hello,
>
> Consider I want to control my input block( like a Dc source in simpower 
> systems category in simulink) using a code( like an M-file code), do u 
> have any suggestion for me?
>
> to be more specific, i model my system in simulink but the input of my 
> system is changing during the excution ( for example if the output is 
> larger than a value the input should change) how I can control this 
> source(DC voltage) source.
>
> Thanks,
> Ela
>

Use a controlled voltage source and feed it whatever signal you want. 
Probably best to use Simulink block rather than MATLAB code to construct the 
signal. You can change a block parameter once the simulation has started 
running using set_param, but a much better approach is to construct the 
signal in Simulink and feed it to the controlled voltage source. If you 
really have to use MATLAB have a look at the Embedded MATLAB function.

HTH,

Arnaud