来自胡新和的问题
matlab用solve解出的方程既有复数也有实数,想取实数中最大值,应该怎么办[o]=solve('(x(f)-a(h))^2+(y(f)-b(h))^2+(r(f)-o)^2=(r(f)+R(h))^2','o');o=subs(o,{'x(f)','a(h)','y(f)','b(h)','r(f)','R(h)'},{x(f),a(h),y(f),b(h),r(f),R(h)
matlab用solve解出的方程既有复数也有实数,想取实数中最大值,应该怎么办
[o]=solve('(x(f)-a(h))^2+(y(f)-b(h))^2+(r(f)-o)^2=(r(f)+R(h))^2','o');
o=subs(o,{'x(f)','a(h)','y(f)','b(h)','r(f)','R(h)'},{x(f),a(h),y(f),b(h),r(f),R(h)});
o=double(o);
A=o==real(o);
o=o(A)
解出后复数解变为Emptymatrix:0-by-1
实数解有两个我想取其中最大的那个应该怎么写
1回答
2020-05-2920:12