How to obtain an array of values during simulation to use in the same simulation?

1 view (last 30 days)
I'm doing a simulation of a motor(PMSM) and i want to aproximate de value of one of the parameters of the motor, de friction coeficient. And for that I need to do a linear iinterpolation between the velocity and the torque gnerated. An from that interpolation i want to extract both of the coeficients, especially the slope. For that Im trying to use a function and grab the values measured from the motor and make an interpolation with polyfit(Speed, Torque ,1) . The problem is that the values that the GoTo block reads are not stored in some type of array or vector. so what enters to the function is a single value and the interpolatino can not be done. I know that i can extract data from structures and do the interpolation in the workspace but for this project the calculation need to be done in simulink.
Any idea on how to do that?
Find attached the model that i'm using.
Thanks for your help in advance!

Answers (1)

Joel Van Sickel
Joel Van Sickel on 9 Nov 2022
One way to store an array of previous values is to use the tapped delay block:


Find more on Composite Components 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!