Integrating this function and trying to solve for a variable displays errors!

조회 수: 4 (최근 30일)
Here is the code with the error:
syms initial theta
ints = int(1/sqrt(cos(initial)-cos(theta)),initial,pi/2);
func = L/sqrt((E*I)/(2*F)) - ints;
S = fsolve(func,0);
S
Error using lsqfcnchk (line 108)
If FUN is a MATLAB object, it must have an feval method.
Error in fsolve (line 235)
funfcn = lsqfcnchk(FUN,'fsolve',length(varargin),funValCheck,gradflag);
Error in GuessesICs (line 65)
S = fsolve(func,0);
I am trying to solve for initial in this function. the fuction is in respect to theta (dθ) so that should not be a problem?
Anythign appreciated
Thank you

채택된 답변

Torsten
Torsten 2022년 7월 7일
편집: Torsten 2022년 7월 7일
L = 1;E = 1;I = 1;F=1;
func = @(initial) L/sqrt((E*I)/(2*F)) - integral(@(theta)1./sqrt(cos(initial)-cos(theta)),initial,pi/2);
S = fsolve(func,0.5)
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
S = 1.1094
func(S)
ans = -8.5387e-12

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by