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

2 ビュー (過去 30 日間)
Hi,
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!

回答 (1 件)

Joel Van Sickel
Joel Van Sickel 2022 年 11 月 9 日
One way to store an array of previous values is to use the tapped delay block: https://www.mathworks.com/help/simulink/slref/tappeddelay.html
Regards,
Joel

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by