フィルターのクリア

How can I control the tolerance in vpasolve?

6 ビュー (過去 30 日間)
Raffaele Di Gregorio
Raffaele Di Gregorio 2023 年 12 月 14 日
コメント済み: Dyuman Joshi 2023 年 12 月 14 日
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?

回答 (1 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023 年 12 月 14 日
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 件のコメント
Raffaele Di Gregorio
Raffaele Di Gregorio 2023 年 12 月 14 日
Thanks! It works well
Dyuman Joshi
Dyuman Joshi 2023 年 12 月 14 日
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

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by