How to solve numerically and find the smallest value?

6 ビュー (過去 30 日間)
SAM
SAM 2023 年 1 月 10 日
回答済み: Rik 2023 年 1 月 10 日
Hello,
I have the following code to numerically find the smallest intersection point between two curves. I used "vpasolve'' to find the solution and it is giving me 1. However, when I draw the two curves, there are other intersection points. Is there a way to solve numerically and find the smallest value?
thank you
clear;clc;close all
syms v L0 x
x=2;
A=sqrt(2)*x*v^(-.5)*(1-(1-v^2)^.5)^.5;
B=sqrt(2)*x*v^(-.5)*(1+(1-v^2)^.5)^.5;
R1=(A/B)^(3)*tan(A);
R2=tan(B);
Solution=vpasolve(R1-R2==0,v);
figure(2)
fplot(R1)
hold on
fplot(R2)

採用された回答

Rik
Rik 2023 年 1 月 10 日
You can supply an initial estimate or a search range to vpasolve, as its documentation explains:
syms v L0 x
x=2;
A=sqrt(2)*x*v^(-.5)*(1-(1-v^2)^.5)^.5;
B=sqrt(2)*x*v^(-.5)*(1+(1-v^2)^.5)^.5;
R1=(A/B)^(3)*tan(A);
R2=tan(B);
Solution=vpasolve(R1-R2==0,v,eps) % supply eps() to get close to 0
Solution = 
0.00000000000000022204460724851781039709854611978
Solution=vpasolve(R1-R2==0,v,[0.1 0.9])
Solution = 
0.38634866606689403108165617379516
fplot(R1-R2)

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by