关于fsolve函数的一些问题。
Mostrar comentarios más antiguos
利用fsolve函数解方程遇到一些问题,希望大佬们给予帮助。
先贴程序
[code]
L1=3;L2=3*(2^0.5);L3=3;
gamma=pi/4;
P1=5;P2=5;P3=3;
X1=5;Y1=0;
X2=0;Y2=6;
syms theta A2 B2 A3 B3 N1 N2 D f;
A2=L3*cos(theta)-X1;
B2=L3*sin(theta);
A3=L2*(cos(theta)*cos(gamma)-sin(theta)*sin(gamma))-X2;
B3=L2*(cos(theta)*sin(gamma)+sin(theta)*cos(gamma))-Y2;
N1=(B3*(P2^2-P1^2-A2^2-B2^2)-B2*(P3^2-P1^2-A3^2-B3^2));
N2=(-A3*(P2^2-P1^2-A2^2-B2^2)+A2*(P3^2-P1^2-A3^2-B3^2));
D=2*(A2*B3-B2*A3);
% 解方程
f=inline(N1^2+N2^2-(P1^2)*D^2);
fsolve(f,[-pi pi])
利用fsolve求解后,给出了两个解,
ans =
-4.167276293093129 2.115909014086458
显然第一个解已经超出了给定的边界,想问问这是怎么回事
而且这个方程在题目条件下是有4个解的,想问问怎么改变程序可以得到给定区间内的四个解。
Equation solved, fsolve stalled.
fsolve stopped because the relative size of the current step is less than the
default value of the step size tolerance squared and the vector of function values
is near zero as measured by the default value of the function tolerance.
<stopping criteria details>
这是运行程序后命令号的提示:
方程式解决,fsolve停滞不前。
fsolve已停止,因为当前步骤的相对大小小于
步长公差的平方值的默认值和函数值的向量
通过函数容差的默认值测量,接近零。
<停止标准详细信息>
以上是google翻译后的结果,不是很理解,希望大佬可以给予帮助
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre 数学 en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!