Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Matlab Simulink Block and VS Dll Value Differences

1 visualización (últimos 30 días)
Fatma Nur  Sevgi
Fatma Nur Sevgi el 1 de Feb. de 2019
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hi,
I have a matlab simulink model which includes s-function blokas and normal matlab blocks. This model do several basic operations like addition, subtruction, multiplication, take sin, cos etc. These operation implemeted both normal matlab blocks and - function blocks. In addition to that I have VD Dll code which do the same operations like matlab simulink blocks.
I give the same double inputs to matlab normal block, s-function block and dll code and operations occurs than I take results.
After taking results, I compare the output of them.When I compare results, I take care about 16 digit presicion both Matlab enviroment and VS dll enviroment. I realized that sometimes the result are different. The result for example 16. digit is diffrent sometimes 15. digit different.
When I realized this case, I tried my basic operations with binary representable decimal doubel number, I hoped I take the same result after operations with binary representable numbers in all enviroments. But I was mistaken.
For example I want to give an example about this mentioned situation ;
For sinus operation
Matlab normal cosinus operation result : cos(242.572265625000) = -0.784050571010560 obtained.
Matlab s-function block result and dll result is the same and result is: cos(242.572265625000) = -0.784050571010561 obtained.
The above example 16. digit is different.
Why this case occur?
I tried my basic operations with different 1000 binary representable decimal numbers and I compared the matlab normal block result, s-function result and dll execution result.
I obtained follwings;
The differences between matlab normal block result and s-function result; mostly differences 0.000000000000000 and - 0.000000000000000 but some times diffrences can be obtained like 0.0000000000000001 , 0.0000000000000002 or 0.000000000000004
The differences between matlab s-function block result and dll result are always equals to either 0.000000000000000 or - 0.000000000000000.
I'll be glad if you can halp me.

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by