update a parameter in function block each timestep in simulink

1 visualización (últimos 30 días)
Ameen Bassam
Ameen Bassam el 16 de Mzo. de 2023
Comentada: Ameen Bassam el 17 de Mzo. de 2023
I have a parameter or a variable (T) which should increase or decrease with a (delta_T) and it has an initial value of (T_0).
So, I defined (delta_T = ....) and (T_0 = 20) and it should be a loop (T = T + delta_T) which updates the value of T each time step.
I will put this function in a block in Simulink.
I hope my question is clear and many thanks in advance.
  1 comentario
Ameen Bassam
Ameen Bassam el 17 de Mzo. de 2023
I have tried the following but failed to update T
function [delta_T,T] = fcn(u)
m=100;
T = 20;
delta_T = u/m;
T_max = 100;
while T <= T_max
T = T + delta_T;
end

Iniciar sesión para comentar.

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 16 de Mzo. de 2023
Use the "Ramp" block to generate such a signal.

Categorías

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

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by