I want to convert a polynomial expression into an array of characters in MATLAB. We are using the command char. On my computer, char will change the format of the coefficients of a polynomial to scientific notation.
For example,
char(x^2 + 0.0001*x)
will output $x^2 +1e-4\cdot x$ as an array of chars. That will generate an error in my program.
Can we get an array which contains $x^2+0.0001\cdot x$ of length $12$ instead of an array containing $x^2+1e-4\cdot x$ which is of length $10$ by using char? If there is a way of turning off the scientific notation in MATLAB, that will be great!
Thanks!
Try converting your symbolic expression to variable precision arithmetic using
vpabefore usingchar:See the documentation for
vpaand fordigitsfor how to adjust the conversion.