How to solve numerically and find the smallest value?
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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)
0 comentarios
Respuesta aceptada
Rik
el 10 de En. de 2023
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=vpasolve(R1-R2==0,v,[0.1 0.9])
fplot(R1-R2)
0 comentarios
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!