Implementing a Discrete Integrator in a Function
Mostrar comentarios más antiguos
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?
Respuestas (1)
Euan Andrew
el 7 de Sept. de 2020
Categorías
Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
