I'm doing the same simulation in two different versions of Matlab/Simulink (2013a and 2017a), but it does not give the same results. Please can someone explain me why?!
How large is the difference between the corresponding values?
If the method of the solution is same then the difference lies in:
Quantization errors where the variables can be quantised by different resolutions or number of bits per sample.
The second cause can be the truncation errors in the mathematical processing specially multiplication and division they need large registers that may not available in the computer.
I use the same solver, same options but i don't know how to solve this. The 2013a (in my old laptop) gives me the results I want. The errors between referentiel values and measured ones is almost 0. In the 2017a version (in a powerful laptop) gives bad results. I want to stop working with the 2013a version, because it takes a lot of time to simulate (hours for just 5 seconds sometimes, and it doesn't work in 64 bits windows version).
simply, this change happens because of the number of digits/computations each computer is able to store. different results is because you're probably using 32-bit version of MATLAB on one machine and 64-bit on the other.
You need to work on old version and same computer, Because your computer uses only a small number of bits to represent your number (on your version of matlab it probably uses 64 bits) you will often have some small part of a decimal number that gets cut off when doing operations. In fact, when you add a very large number to a very small number, the computer may return only the very large number as the result because there is "no more room" to represent the smaller number.
Some answers are wrong, different operating systems (32 or 64) have different ranges of accessible memory addresses. The 32 bit system can access less than 3GB RAM of your PC, in this case matlab/simulink can consume up to 500MB for storing ALL variables (it is just 128 by default). If you have a larger RAM of your PC (4, 8, or 16 GB) you have a wider memory range. And I recommend 64 to use most of it. That's all what it means. The issue 32/64 is only (Error: out of memory), and it's not your case.
Now talking about the precision, both 32bit and 64bit Matlab versions can use the single precision (32 bits for a variable) or double precision (64 bits for a variable). By default, they both use the double precision (8 Bytes). You can check this with simple calculations.
It is therefore not a matter of precision, unless you are restricting one version to single and the other to double precision.
If your simulated model include some noise functions (or random seed generators), you should know that these functions were updated. The later ones give more realistic (random) noise which is hard to predict. That could be the reason for your errors, and it is practical. Disable the noise to see the effects.
If you are using I/O data transfer from files, you have to control the precision in your reading functions (it is not the same by default).
I hope you can find the problem, and I would really like to know what was it.
I've improved the simulation results but reducing the relative tolerance. Now I almost have same results in the two versions using:
With matlab 2017a: relative tolerance of 1e-5
With matlab 2013a : relative tolerance of 1e-3
I really can not understand this difference.
Secondly, the problem is that I'm working on two simulation: the first is a classical control technique, and the second is the same technique but improved). What have been said above consider only the first one. For the second one, I simulate it in 2017a using a relative tolerance of 1e-3, because impossible to simulate it with 1e-5, it takes hours to just simulate 2 seconds.
My question is : Is it possible to compare between the performance of both techniques even though the simulation conditions are not the same?!
With new versions of Matlab there are improvements or changes in some functions.
You need to read the list of changes in the documentation.
Only an exhaustive self test of the code will reveal problems. You need unit tests for all functions, and an integration test for the main code. Automatic tests for GUIs are required in addition.
In model configuration parameters, you may use the same solver and try to do the simulation having fixed step in both the cases instead of having variable step. All other parameters under model configuration parameters should also be same. Install the 32 bit or 64 bit version of MATLAB according to your computer operating system (32 bit or 64 bit).
You can also try to check the difference by running a simple MATLAB simulink model in both versions.
Hi, I think the informations about the input data in the two versions are not the same, check carefully, may be there are small differences which make difference in simulation.