Determine Critical Points Numerically
2 次查看(过去 30 天)
显示 更早的评论
I was wondering if anyone had any suggestions on how to find the critical points of this function numerically with respect to the variables r and phi. For the variable h, I do not have an exact value for it, but I know the range of values for it. I have been unable to solve this analytically using the solve function. Any help would be appreciated!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/528199/image.jpeg)
2 个评论
Walter Roberson
2021-2-23
I tried copying the image into MATLAB to experiment with the function, but MATLAB doesn't seem to be able to execute images :(
回答(1 个)
Walter Roberson
2021-2-23
EA=30000;
alpha=30;
beta=30;
gamma=180-(alpha+beta);
a=20;
n=6;
L_ab=a;
L_bc=(a*sind(alpha))/(sind(beta));
L_ac=(a*sind(alpha+beta))/(sind(beta));
hmax=L_bc*cosd(180-(90+(180-gamma)));
%h = 0.1:0.1:hmax;
h = 0.1 + rand()*(hmax-0.1);
disp(h)
syms r phi
U=((n*EA)/2)*(L_ab*((2*(r/L_ab)*sin(pi/n)-1)^2)+L_bc*(((sind(beta)/sind(alpha))*sqrt(((h/L_ab)^2)...
-(2*((r/L_ab)^2)*cos(phi))+2*((r/L_ab)^2)))-1)^2+L_ac*((sind(beta)/sind(alpha+beta))*sqrt(((h/L_ab)^2)...
-(2*((r/L_ab)^2)*cos(phi+(2*pi/n)))+(2*((r/L_ab)^2)))-1)^2);
dUr = diff(U,r);
dUphi = diff(U,phi);
F = matlabFunction([dUr, dUphi], 'vars', {[r,phi]});
disp(F)
N = 100;
sols = zeros(N,4);
Nsol = 0;
opts = optimoptions(@fsolve, 'display', 'none');
for K = 1 : N
guess = 10*randn(1,2);
[onecrit, fval, exitflag] = fsolve(F, guess, opts);
if exitflag > 0
Nsol = Nsol + 1;
sols(Nsol,:) = [guess, onecrit];
end
end
sols = sols(1:Nsol,:);
disp(sols(1:10,:))
disp('---')
criticals = uniquetol(sols(:,3:4),0.0001,'byrows', true);
disp(size(criticals))
format long g
disp(criticals)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Particle & Nuclear Physics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!