I recently updated my installation of Matlab from 2010a to 2012a. I have a fairly large program that I developed to calculate/plot the results of the research I am doing in tire modeling. Due to the precision needed to calculate the results, I have to do the majority of calculations in the Symbolic Toolbox and import the results to Matlab. When I run the program from MuPad, I get the following results:
thetaS = 0.2009477451 thetaL = 0.1745329252 lambda = 0.001609149705 delta = 0.004816291818 L = 0.1149593055 F = 820.2820398
However, when I run the same program with the same inputs from Matlab 2012a and import the results, I get the following results:
thetaS = 0 thetaL = 0.17453 lambda = 0.001381587043 delta = -0.00217123178 L = 0.1149747052 F = 172.866371
When I run the exact same program with the exact same input in Matlab 2010a, I get the same results that MuPad gives.
The value of the last four results above are calculated by solving a linear system of equations with input values of thetaL and thetaS. The value of thetaS is found by solving that system of equations with various values of thetaS until certain requirements are met. One of those requirements is that thetaS be between thetaL and some value greater than thetaL. Therefore, it seems as though Matlab 2012a is somehow setting thetaS equal to zero and solving the system of equations, disregarding the fact that the requirements are not being met. This seems quite illogical to me.
My question is what changed between release 2010a and 2012a that could be causing this? I have looked through the release notes published online and could not find anything that looked like it might have caused it. Is there other changes listed somewhere that might give me a clue to what happened? I am currently upgrading to 2012b to see if the problem has been fixed in that release.
If there is any other information I can provide I will do my best to provide it. Just let me know.
Thanks in advance!
Edit: I have just observed the same behavior noted in Matlab 2012a in Matlab 2012b. That is to say, the same results are produced.
I just found the answer to my question. I had a line of code that said the following:
if thetaL~=0 then thetaS=0: else % Calculate what thetaS should be end_if:
In MuPad, the ~= operator means "approximately equal to," which is true when the difference between the two values is less than the environment variable DIGITS. However, in Matlab, the ~= operator obviously means "not equal to." Therefore, when my program was run in the MuPad environment, ~= was interpreted as the _approx function and resulted in what I expected. At some point between Matlab 2010a and Matlab 2012a, the Matlab editor becaome the default editor for MuPad program files. I believe this resulted in Matlab interpreting ~= as "not equal to" instead of "approximately equal to" as it had before. As I have already mentioned, Matlab was already interpreting i as the imaginary number, so I don't know why I wasn't having this problem before.
In any case, the solution to my problem was to use the _approx function directly instead of the ~= operator.
It seems like if MuPad is going to become more and more integrated into Matlab, the syntax of MuPad should be made as similar to Matlab's syntax as possible.
Play games and win prizes!Learn more