Hi
Is there anyway I can write to a variable in simulink and use in for example a gain block.
For example, if I have a clock source block, I would like to write the time generated by clock, to a variable "t", and use that variable in a gain block as gain(1/t). I am having some difficulty in doing it, but was just thinking that there must be a way to do it.
Regards Adam

 Akzeptierte Antwort

Orion
Orion am 10 Nov. 2014

0 Stimmen

Hi,
you can send the result of simulation in the workspace of matlab with a to workspace block
and after the simulation, you can posttreat the data
but, if you want to use the current time to do a calculation during the simulation, for example as the parameter in a gain block, you need to model differently.
Because a gain uses a value defined in his mask at the begining of the simulation, you can't change it.
you need to multiply your input by the inverse of the signal coming from your clock block (careful at t=0).

Weitere Antworten (0)

Kategorien

Mehr zu Simulink finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 10 Nov. 2014

Beantwortet:

am 10 Nov. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by