update a parameter in function block each timestep in simulink

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

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

댓글을 달려면 로그인하십시오.

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2023년 3월 16일

0 개 추천

Use the "Ramp" block to generate such a signal.

카테고리

도움말 센터File Exchange에서 Simulink에 대해 자세히 알아보기

제품

릴리스

R2019b

질문:

2023년 3월 16일

댓글:

2023년 3월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by