MATLAB: I am getting an asterisk as the output for the script

format ratfprintfoutputrat

I am trying to create a script to perform second order ODE's in a user friendly environment. For some reason when I use the fprintf i cannot get it to print out the value however the value is stored, it just prints a "*". I want my answers to be in fractions, it works except when it is a large fraction. I was trying to perform the complex root ODE with coefficients a=4, b=24, c=37 and IVP of y(pi)=1 dydt(pi)=0
I cant figure out how to add my code correctly but i have attached the m file

Best Answer

rats() returns * for any value from 10^13 and larger, or any value from -10^12 and less (more negative), or any non-zero value sufficiently value sufficiently close to 0, or even some values as large as 0.000999 (but works for 0.0009999)
I suggest that instead of calling rats, you call the two-output version of rat() and format the pieces.