how to find minimum of discontinuous symbolic function

2 次查看(过去 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 个评论
Maggie liu
Maggie liu 2021-8-2
@Walter Roberson Sorry for not showing them when I asked the question. I have updated the description with the sample variables. Thanks!

请先登录,再进行评论。

采纳的回答

Walter Roberson
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
A = 1×3
-0.4322 0.2514 0.7427
B = [-0.0987 -0.2834 1.8999] %a point on sphere surface
B = 1×3
-0.0987 -0.2834 1.8999
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)
DD = 
DD1c = simplify(cos(2*children(DD,1)))
DD1c = 
limpoint = vpasolve(DD1c == 1, pi)
limpoint = 
3.7910906782081747162135888997947
D(limpoint)
ans = 
0.9588763931357714838022843054125

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by