How can I use function handles in Simulink?

7 visualizaciones (últimos 30 días)
Maximilian Schönau
Maximilian Schönau el 2 de Dic. de 2020
Comentada: Maximilian Schönau el 4 de Dic. de 2020
Hello,
i found similar questions, but none did account for my problem in Simulink.
I have a function handle in my model workspace, and I want to use it as a function in the model.
How can I use the function handle in the model workspace, to compute an output by the given input?
The function in the workspace has this shape:
y = @ (t) f(t);
With f beeing a function a compute in a different script which could change.
Looking forward to any Help :)

Respuesta aceptada

Simone Lagger
Simone Lagger el 4 de Dic. de 2020
I had the same problem and I found this method using the symbolic math toolbox and Simulink Interpreted MATLAB Fcn block that works :
https://it.mathworks.com/matlabcentral/answers/578619-using-a-function_handle-variable-from-workspace-in-simulink
  1 comentario
Maximilian Schönau
Maximilian Schönau el 4 de Dic. de 2020
Thank you very much! That is exactly what I was looking, for.
Neverthenless kinda strange that function handles dont function with simulink. Is there any better way to use a changing function in Simulink?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Simulink en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by