![]() However, I'm not sure what you have against vpa as it is actually a much cleaner way to do this: b1 = vpa(a)*x or b1 = vpa(a*x). If you want a more automatic way of converting floating point values to "exact" decimal representations with sym, you might try something like this: syms xĠ.000000000000000000000000010000000000000000384948697491918*x Matlab has probably chosen the other method as the default because the representation is not easily confused with floating-point. sym(0.1,'d') uses the floating-point value of 0.1 to length digits. However, care should be taken in how you do this, as the following example illustrates: syms xĪs you know, many floating-point decimal values are not exact. ![]() )7.577619127319697e-320, where A and B are functions of my variables (too complex to repeat. m-file (using matlabFunction).For some reason, after simplifying the function, the function is returned on a form that looks like fun (A1.329834759483753e310 + B5.873798798237459e305 +. If you want to use decimal approximation/representation, then you'll need to directly specify that. I am using Matlab symbolic toolbox to create a function of high complexity. ![]() ![]() As per the documentation for sym, the default conversion method for numeric values is rational approximation/representation, the 'r' flag. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |