Algebraic Loop Error and does not linearization

2 visualizzazioni (ultimi 30 giorni)
Doga Selcuk
Doga Selcuk il 17 Gen 2022
Commentato: Erik Erik il 5 Giu 2023
Hello everyone, i'm working on (Control Tutorials for MATLAB and Simulink - Inverted Pendulum: Simulink Modeling (umich.edu)) Inverted pendulum modelling, however in 2021 version Matlab does not have "fcn" function so i tried to fix this problem by using matlab function. Now i can not have the graph and linearization cause i always have the same error which is Algebraic loop error with 'untitled1/Subsystem/MATLAB Function'. I'll try to explain what i have done
1) I created integrators and function blocks etc.
2) I used Mux for 4 functions as in the link given above.
3) I coded functions in those block.
4) When i connected them with muxes i followed muxed input numbers and my code values.
5)I cretaed subsystem. Add scope and trim it.
I need to linearization and see graphs but i can't.
function y = fcn(u)
m=0.01;
l=0.3;
y =m*(u(1)-l*u(2)^2*sin(u(3))+l*u(4)*cos(u(3)));
%This is for N value.
%Codes Errors:
Index expression out of bounds. Attempted to access element 2. The valid range is 1-1.
More information
Function 'Subsystem/MATLAB Function' (#55.53.54), line 4, column 20:
"2"
Launch diagnostic report.
Component:MATLAB Function | Category:Coder error
Errors occurred during parsing of MATLAB function 'untitled1/Subsystem/MATLAB Function'
Component:MATLAB Function | Category:Coder error
Simulink cannot determine sizes and/or types of the outputs for block 'untitled1/Subsystem/MATLAB Function' due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
Component:MATLAB Function | Category:Coder error
Cannot solve algebraic loop involving 'untitled1/Subsystem/P' because it consists of blocks that cannot be assigned algebraic variables, such as blocks with discrete-valued outputs, blocks with non-double or complex outputs, Stateflow blocks, or nonvirtual subsystems. Consider breaking the algebraic loop. For example, add a delay or a memory block to the loop. To see more details about the loops use the command Simulink.BlockDiagram.getAlgebraicLoops(bdroot)
Component:Simulink | Category:Model error
Algebraic loop error with 'untitled1/Subsystem/MATLAB Function3'
Component:Simulink | Category:Model error
Algebraic loop error with 'untitled1/Subsystem/N'
Component:Simulink | Category:Model error
Algebraic loop error with 'untitled1/Subsystem/MATLAB Function'
Component:Simulink | Category:Model error
Algebraic loop error with 'untitled1/Subsystem/P'
  5 Commenti
Doga Selcuk
Doga Selcuk il 20 Gen 2022
Modificato: Doga Selcuk il 20 Gen 2022
I added algebraic constant to avoid loop error, it works but still i can not find those graphs.
I changed some constants properties, such as solver: Trust region.
Erik Erik
Erik Erik il 5 Giu 2023
Hello, did you manage to remove the algebraic loop?

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by