Notice that you are dividing the outputs from qfunc using only 4 decimal points to verify your analytic result. Actually, MATLAB is showing a short visualization format when you type a1, a2 and P.
If you type format long and show the values for a1 and a2 you will notice that you are getting different results because you are truncating a1 and a2 to 4 decimal points when verifying your results:
0.0228/0.0668 = 0.3413
but actually, the correct result is:
>> P = a2/a1
P =
0.340534126802047
since a1 and a2 have many more decimal places...
Best Answer