how to control a contant/ trigger signal in simulink FROM an m-file?

5 Ansichten (letzte 30 Tage)
Hi! I'm using an m file to control a simulation (simulink slx file). The user enters the stop time. When the simulation time reaches its half value, (ie halfway through the simulation,) I need to change a constant from 0 to 1. when it reaches 75%, I need to change the (same) constant source from 1 to 0.
so my question is, how do we control the value of the constant block (or any other block that can produce a const, eg. a step block, or signal generator) with respect to the simulation time from an m file?
Please help me.. I googled a lot but couldn't find a solution thanks
  1 Kommentar
vainateya goldar
vainateya goldar am 11 Jun. 2015
just to add a detail: I can embed a code in the simulnk also. for example, if stop_time is the stoptime of the model, then, if possible, i can write a code in the simulink model itself to change the const value at stop_time/2 and 3*stop_time/4 instead of using an m file

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

vainateya goldar
vainateya goldar am 11 Jun. 2015
oh I myself found the soln :) kinda dumb of me ;)
you simply need the FROM WORKSPACE block. enter a 2-columned matrix in it, 1st column contains time with respect to stop time and 2nd contains const values........
not removing this question in case anybody needs it

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by