Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

parameter sweep in simulink

1,180 views
Skip to first unread message

joskem joskem

unread,
Dec 13, 2009, 9:36:02 AM12/13/09
to
Hi there!

I designed a very simple electronic circuit in Simulink (Simscape). It consists of a dc voltage source and two resistors connected in series. When the values of these two resistors are kept constant, then I can build the model with RTW. But I want to sweep the value of one of the resistors. So, when I put the resistor's value equal to R (which I am going to change through the matlab's workspace), then I can't build the model. What should I do?

Thanks!

thierry

unread,
Dec 15, 2009, 4:02:36 AM12/15/09
to
Hi Joskem,
I have the same problem.
Do you find a solution?
Many thanks


"joskem joskem" <jos...@pathfinder.gr> wrote in message <hg2u4i$9p9$1...@fred.mathworks.com>...

Arnaud Miege

unread,
Dec 15, 2009, 6:05:13 AM12/15/09
to

"joskem joskem" <jos...@pathfinder.gr> wrote in message
news:hg2u4i$9p9$1...@fred.mathworks.com...

Hi, code generated by Simscape doesn't support tuneable parameters, which is
why you can't change the value of the resistor, once the model has been
built with RTW. Have a look at the documenation for limitations when
generating code:
http://www.mathworks.com/access/helpdesk/help/toolbox/physmod/simscape/ug/bq91pc7.html#bq91pov-1
http://www.mathworks.com/access/helpdesk/help/toolbox/physmod/simscape/ug/bqqjdvg-1.html

To work around this, use the variable resistor block instead:
http://www.mathworks.com/access/helpdesk/help/toolbox/physmod/simscape/ref/variableresistor.html

If you feed the block with a Simulink block (e.g. constant) through
Simulink-PS interface block, you should be able to tune the resistor value.

Have a look at this video for an example:
http://www.mathworks.com/products/demos/simscape/param_projector/index.html

HTH,

Arnaud


joskem joskem

unread,
Dec 15, 2009, 2:10:19 PM12/15/09
to
Thank you Arnaud!

That works perfect! But considering another case where I have an AC voltage source in my circuit, then the controlled voltage source block only lets me to externally choose the amplitude of the sine wave. What could I do to sweep its frequency?

Thanks again!

Arnaud Miege

unread,
Dec 16, 2009, 8:10:28 AM12/16/09
to

"joskem joskem" <jos...@pathfinder.gr> wrote in message
news:hg8mur$961$1...@fred.mathworks.com...

Hi,

The controlled voltage source block takes whatever signal you feed it with,
so you could use a Sine Wave block from Simulink (again, through a
Simulink-PS Converter block), and sweep the frequency of the Sine Wave
block.

HTH,

Arnaud


joskem joskem

unread,
Dec 17, 2009, 8:29:08 AM12/17/09
to
Thanks so much!
0 new messages