필터 지우기
필터 지우기

Solving nonlinear equations that include integrals with embedded variables

조회 수: 2 (최근 30일)
Ke Wu
Ke Wu 2020년 9월 8일
댓글: Ke Wu 2021년 2월 16일
Hi there,
As mentioned in the subject, I have a fsolve-related question here.
This below is what I need to solve considering that theta_o is the only unknown:
I tried to use 'fsolve' to solve this, but no solution found.
clear;clc;close all
options = optimset('TolFun', 1e-20, 'Display', 'iter', 'MaxFunEvals', 1e10, 'MaxIter', 1e9, 'Algorithm', 'levenberg-marquardt');
T = 0.003;
H = 0.08;
I = H*T^3/12;
Px=10;
Py=1;
Mo=5;
P=Py;
n=Px/Py;
l=0.1;
E=69*10^10;
UnknownGuess = rand(1, 1);
[Unknowns, fval,exitflag] = fsolve('LD', UnknownGuess, options, I, P, n, Mo, l, E);
Theta = Unknowns(1);
%% LD function
function Eq = LD(Unknown, I, P, n, l, E, Mo)
Eq(1)=integral(@(x) 1./((2*P/E/I*(n*cos(x)-sin(x)-n*cos(Unknown(1))+sin(Unknown(1)))+Mo^2/E/E/I/I).^0.5),0,Unknown(1))-l;
end
%%%
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
value of the function tolerance.
It‘s supposed to have a solution but I must made a mistake there.
Anyone can help me out?
Thanks so much,
Ke

채택된 답변

Dana
Dana 2020년 9월 8일
Your call to fsolve:
fsolve('LD', UnknownGuess, options, I, P, n, Mo, l, E)
Your function syntax for LD:
Eq = LD(Unknown, I, P, n, l, E, Mo)
The last three parameters are in a different order. Change your call to fsolve to
fsolve('LD', UnknownGuess, options, I, P, n, l, E, Mo)
and I suspect that'll fix the problem.

추가 답변 (1개)

Alan Stevens
Alan Stevens 2020년 9월 8일
If Dana's suggestion doesn't work, the following non-symbolic approach does:
theta0init = pi/2;
theta0 = fzero(@intfn, theta0init);
disp([num2str(theta0) ' radians'])
disp([num2str(theta0*180/pi) ' degrees'])
function F = intfn(theta0)
T = 0.003;
H = 0.08;
I = H*T^3/12;
Px=10;
Py=1;
Mo=5;
P=Py;
n=Px/Py;
E=69*10^10;
l=0.1;
F = integral(@(theta) 1./(2*P/E/I*(n*cos(theta)-sin(theta)-n*cos(theta0)+sin(theta0))+Mo^2/E/E/I/I).^0.5 , 0 ,theta0) - l;
end

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by