Azzera filtri
Azzera filtri

The calculation result of the Matlab function is incorrect.

1 visualizzazione (ultimi 30 giorni)
When I was conducting Simulink simulation, I encountered the following issues:
At the same time, the reference value is fixed and different id_p are entered has different calculation results Te_ P. The error is equal to the square of (Te_p-Reference).The key issue is that the calculated value in scenario 2 is closer to the reference value, but the calculated error result is larger, which is contradictory. Please refer to the picture.
  2 Commenti
madhan ravi
madhan ravi il 18 Dic 2023
Modificato: madhan ravi il 18 Dic 2023
Can you perhaps try it with fixed point data instead? Uint64 with minute slope, 1e-8 for example?
hard study
hard study il 19 Dic 2023
Thank you for your reply. This is just my mistake, due to the issue of data latency.

Accedi per commentare.

Risposta accettata

Ganesh
Ganesh il 19 Dic 2023
From the values, I can see that the error value is being computed wrongly for every value of "Te_up". However, the value of "Te_ref_up" being used for error calculation is consistent, with the value being 0.6113857267404.
Here are the possible resolutions for the issue you are facing:
  1. Clear all the variables in Model Workspace and start fresh.
  2. Use a higher precision data structure for storing the reference value.
  3. Ensure that "Te_ref_Up" is not changing during the simulation.
  4. Check the value of the signal that is being connected to the function block to know what value is being passed.
Please refer to the following documentation on defining variables inside a MATLAB Function Block :
Hope that helps!
If the issue persists, kindly reach out to MathWorks Technical Support
Thanks,
Ganesh S
  1 Commento
hard study
hard study il 19 Dic 2023
Spostato: Stephen23 il 19 Dic 2023
Thank you for your reply. This is just my mistake, due to the issue of data latency.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Simulink Functions in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by