Determine Critical Points Numerically
5 views (last 30 days)
Show older comments
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!
2 Comments
Walter Roberson
on 23 Feb 2021
I tried copying the image into MATLAB to experiment with the function, but MATLAB doesn't seem to be able to execute images :(
Answers (1)
Walter Roberson
on 23 Feb 2021
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 Comments
See Also
Categories
Find more on Equation Solving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!