Reputation:
I am writing a Matlab script that solves a system of differential equations via the Runge-Kutta method. Due to the iterative nature of this approach, errors accumulate very quickly. Hence I'm interested in carrying an extremely exaggerated number of decimal points, say, 100.
I have identified the digits function, which allows me to define the variable precision accuracy. However, it seems that I have to specify the vpa function in every equation where I want this precision used. Is there a way to put a command in the script header and have the specified number of decimal places used in all calculations? Matlab help is unusually unclear about this.
Upvotes: 2
Views: 149
Reputation: 36720
There is no way to tell matlab to use vpa
everywhere. Typically you don't specify it in every equiation, instead cast all inputs and constants to vpa.
Upvotes: 2