Azzera filtri
Azzera filtri

How can I control the tolerance in vpasolve?

6 visualizzazioni (ultimi 30 giorni)
Raffaele Di Gregorio
Raffaele Di Gregorio il 14 Dic 2023
Commentato: Dyuman Joshi il 14 Dic 2023
I am using vpasolve to solve a system of seven equations in seven unknowns.
I have a set of data that solve the system with a tolerance of 0.1e-3 (that is, the tolerance with which the absolute value of the difference between the left-hand side and the right-hand side of each equation is equal to zero). Such a tollerance is OK for my applications, but, unfortunately, vpasolve uses as default tolerance a tighter value and it is not able to find the solutions of my system.
How can I control the tolerance in vpasolve?

Risposte (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov il 14 Dic 2023
Here is one example show how to adjust vpasolve tolerance:
syms x
EQN = sin(2*x) == 0.5;
% Default
sol_D= vpasolve(EQN,x)
sol_D = 
0.26179938779914943653855361527329
% Controlled using digits()
N = 3;
digits(N)
sol_C= vpasolve(EQN,x)
sol_C = 
0.262
  2 Commenti
Dyuman Joshi
Dyuman Joshi il 14 Dic 2023
This just changes the number of significant digits of the output. It does not satisfy the tolerance, see below.
And I don't think vpasolve() uses any tolerance to solve.
syms x
EQN = sin(2*x) == 0.5;
% Default
sol_D= vpasolve(EQN,x);
% Controlled using digits()
N = 3;
digits(N)
sol_C= vpasolve(EQN,x)
sol_C = 
0.262
isAlways(abs(0.5-sol_C)<10^-N)
ans = logical
0

Accedi per commentare.

Categorie

Scopri di più su Simulink Functions in Help Center e File Exchange

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by