Implementing a Discrete Integrator in a Function
Ältere Kommentare anzeigen
I am currently using a discrete integrator block in Simulink. It is part of a PLL, so I need it to integrate up to 2*pi then reset to zero and repeat, exactly as it does in the included Simulink 3-ph PLL block.
I would now like to implement this integrator as a MATLAB function as a prelude to implementing it in C code. However, I have run into a problem as I need to use persistent variables to store the state, however, Simulink does not allow persistent variables within an algebraic loop. Instead of using persistent variables, I tried to use variables stored in the MATLAB workspace and pass them as parameters, however, MATLAB passes them by value so the original variables remain unaltered after each iteration.
Has anyone tackled this issue before?
Antworten (1)
Euan Andrew
am 7 Sep. 2020
Kategorien
Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
