×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Changing Block Parameters

Changing Block Parameters

Changing Block Parameters

(OP)
Dear all,
I'm just getting started with Simulink, worked myself yesterday through 100pages of tutorial and 12hour of videos - well at least it felt this way. And of course everything is much more complicated than I expected. I hope I'm not bothering you now with some stupid beginners questions:

I need to change the parameters of a Block during the simulation. E.g. take a Sine-source and change the frequency.
I tried a workaround with an "embedded Matlab Block", but there I could not find an access to the system time.

Do you have any suggestions?

 

RE: Changing Block Parameters

Off the top of my head, open the sine generator up, type an equation in t in the line for the frequency.

Or, create an m block with 2 inputs , stick t in one, from the clock, and your desired frequency into the other, and enter an appropriate equation into the block, with one output.

 

Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies  http://eng-tips.com/market.cfm?

RE: Changing Block Parameters

(OP)
Hi Greg!

Thanks for your answer!
Unfortunately equations in t don't work in the parameter field.
The clock part is doing the job here, thanks!!!

I still have other blocks where I would like to edit the parameters, e.g. a transfer function which I would like to tune during the simulation.

I have seen that one can use Matlab variables as parameters.
Is there a way to change a simple matlab variable from simulink? E.g. let's define variable "time" which should be set by a clock-source.

RE: Changing Block Parameters

Yes sorry, method 1 was wrong.

The way I did method 2 was to create an embedded function block sine_out, with 2 input args freq and time, drove freq from the ramp generator and time from the clock.

Writing variables back and forth into and out of matlab is possible, at a guess using in and out ports. I think you have to enable something in the system config as well.



 

Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies  http://eng-tips.com/market.cfm?

RE: Changing Block Parameters

(OP)
Hi Greg!
Thanks, yes I tried the Input/Output blocks "From Workspace" and "To Workspace". "To Workspace" creates an array or more complex structures where time and value are stored. I couldn't get them to overwrite a simple integer variable which each sampling.
 

RE: Changing Block Parameters

Hi,

I think you can use "tag" blocks (From/Goto) from 'Signal Routing' lib to define a tunable parameter.

 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources