matlab使用fsolve求解方程时返回的数据类型出现错误。
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
果博东方开户注册【微8785092】
el 23 de Mayo de 2023
Respondida: 果博东方开户【微8785092】
el 23 de Mayo de 2023
建立调用函数:
function F=myfun(a)
syms a
r1=34.5;a2=0.4472;r=0.38*3;k2=tan(43*pi/138);
x1r11=1.3459+r*(cos(a2)-cos(a));
y1r11=-3+r*(sin(a2)-sin(a));
v2=(x1r11-y1r11*cot(a))/r1;
x1r1=x1r11*cos(v2)+y1r11*sin(v2)+r1*(sin(v2)-v2*cos(v2));%主动轮齿根过渡曲线
y1r1=-x1r11*sin(v2)+y1r11*cos(v2)+r1*(cos(v2)+v2*sin(v2))-34.5;%齿轮啮合原理式1-120
F=diff(y1r1)/diff(x1r1)+1/k2;
end
matlab主程序:
F=@myfun;
a1=fsolve(F,0)
错误使用fsolve
FSOLVE requires all values returned by functions to be of data type double.
0 comentarios
Respuesta aceptada
果博东方开户【微8785092】
el 23 de Mayo de 2023
仅供参考
opts = optimoptions(@fsolve,'Algorithm', 'levenberg-marquardt');
F=@myfun;
a1=fsolve(F,0,opts)
function F=myfun(a)
r1=34.5;a2=0.4472;r=0.38*3;k2=tan(43*pi/138);
x1r11=1.3459+r*(cos(a2)-cos(a));
y1r11=-3+r*(sin(a2)-sin(a));
v2=(x1r11-y1r11*cot(a))/r1;
x1r1=x1r11*cos(v2)+y1r11*sin(v2)+r1*(sin(v2)-v2*cos(v2));%主动轮齿根过渡曲线
y1r1=-x1r11*sin(v2)+y1r11*cos(v2)+r1*(cos(v2)+v2*sin(v2))-34.5;%齿轮啮合原理式1-120
F=diff(y1r1)/diff(x1r1)+1/k2;
end
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!