Solving a Simulink Function with Algebraic Loop

8 次查看(过去 30 天)
I have a MATLAB function that does some calculations and gives 3 outputs which will be used again as an input to this function. This function is like
function [out1,out2,out3]=LoopFunction(out1,out2,out3,param1,param2,param3,param4,input,param5)
% does something...
input variable will be used as a step function and param inputs are just constants.
Normally in MATLAB i can do something like this and do what i want just fine
param1 = 1 ; param2 = 1; param3 = 1; param4 = 1 ; param5 = 1;
out1_init = 1;
out2_init = 1;
out3_init = 1;
for i=1:1000
if i == 1
[out1,out2,out3] = LoopFunction(out1_init,out2_init,out3_init,param1,param2,param3,param4,1,param5)
else
[out1,out2,out3] = LoopFunction(out1,out2,out3,param1,param2,param3,param4,1,param5)
end
end
But i don't know how to do this on Simulink. Is there any way to implement this? So far i have tried something as belows but i cannot find a way to initilize out1 , out2 and out3.
Thank you

回答(1 个)

Sam Chak
Sam Chak 2022-5-27
This article explains about the Algebraic Loop Concepts:
and this one suggests some solutions that you can take:

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by