How to solve numerically and find the smallest value?

7 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Mathematics 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by