Solving a Simulink Function with Algebraic Loop
6 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Sam Chak
on 27 May 2022
This article explains about the Algebraic Loop Concepts:
and this one suggests some solutions that you can take:
0 Comments
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!