matlab使用fsolve求解方程时返回的数据类型出现错误。
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
果博东方开户注册【微8785092】
am 23 Mai 2023
Beantwortet: 果博东方开户【微8785092】
am 23 Mai 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 Kommentare
Akzeptierte Antwort
果博东方开户【微8785092】
am 23 Mai 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!