how to find minimum of discontinuous symbolic function
4 ビュー (過去 30 日間)
古いコメントを表示
My function looks something like this
%parameters for a capped cylinder centered on z axis
R = 0.5; %radius of sphere
r = 0.5; %radius of cylinder
L = 3; %length of cylinder
h = sqrt(R^2-r^2);
shift = (L/2)-h;
A = [-0.4322 0.2514 0.7427] %a point on cylinder surface
B = [-0.0987 -0.2834 1.8999] %a point on sphere surface
a1 = A(1); a2 = A(2); a3 = A(3);
b1 = B(1); b2 = B(2); b3 = B(3);
syms phi
D = @(phi) sqrt((r.*(atan2(a2,a1)-phi)).^2+(a3-L./2).^2) ... %distance between the two points as a function of phi
+ R*acos(((b1.*cos(phi)+b2.*sin(phi)+(b3-shift)*(L./2-shift)))./R.^2);
And this is its graph over 0,2pi
as shown above, the minimum occurs at one of the asymptote. My question is how can I get the x coordinate of the asymptote?
Thanks for your help!!
2 件のコメント
採用された回答
Walter Roberson
2021 年 8 月 2 日
%parameters for a capped cylinder centered on z axis
R = 0.5; %radius of sphere
r = 0.5; %radius of cylinder
L = 3; %length of cylinder
h = sqrt(R^2-r^2);
shift = (L/2)-h;
A = [-0.4322 0.2514 0.7427] %a point on cylinder surface
B = [-0.0987 -0.2834 1.8999] %a point on sphere surface
a1 = A(1); a2 = A(2); a3 = A(3);
b1 = B(1); b2 = B(2); b3 = B(3);
syms phi real
D = @(phi) sqrt((r.*(atan2(a2,a1)-phi)).^2+(a3-L./2).^2) ... %distance between the two points as a function of phi
+ R*acos(((b1.*cos(phi)+b2.*sin(phi)+(b3-shift)*(L./2-shift)))./R.^2);
DD = D(phi)
DD1c = simplify(cos(2*children(DD,1)))
limpoint = vpasolve(DD1c == 1, pi)
D(limpoint)
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!