Numerically solve equations with variables inside numerical integration
Ältere Kommentare anzeigen
I am trying to solve equations in a form of

where C1, C2, C3 are known and
, M, F are variables to be solved. I have tried fsolve() like (below is definitely a simplified version for better illustration)
, M, F are variables to be solved. I have tried fsolve() like (below is definitely a simplified version for better illustration)x = fsolve(@tobesolve,[0,0,0])
function rei = tobesolve(mud,M,F)
rei(1) = integral2(@(p,theta)intfun1(p,theta,mud,M,F),0,631,0,pi)-600;
rei(2) = integral2(@(p,theta)intfun2(p,theta,mud,M,F),0,631,0,pi)-400;
rei(3) = integral2(@(p,theta)intfun3(p,theta,mud,M,F),0,631,0,pi)-200;
end
function i1 = int1(p,theta,mud,M,F)
i1 = p+theta+mud+M+F;
end
function i2 = int2(p,theta,mud,M,F)
i2 = p-theta-mud-M-F;
end
function i3 = int3(p,theta,mud,M,F)
i3 = p+theta-mud+M-F;
end
What is unexpected is that the error read
>> main
函数或变量 'M' 无法识别。
出错 main>@(p,theta)int1(p,theta,mud,M,F) (第 24 行)
rei(1) = integral2(@(p,theta)int1(p,theta,mud,M,F),0,631,0,pi)-600;
出错 integral2Calc>integral2t/tensor (第 228 行)
Z = FUN(X,Y); NFE = NFE + 1;
出错 integral2Calc>integral2t (第 55 行)
[Qsub,esub] = tensor(thetaL,thetaR,phiB,phiT);
出错 integral2Calc (第 9 行)
[q,errbnd] = integral2t(fun,xmin,xmax,ymin,ymax,optionstruct);
出错 integral2 (第 105 行)
Q = integral2Calc(fun,xmin,xmax,yminfun,ymaxfun,opstruct);
出错 main>tobesolve (第 24 行)
rei(1) = integral2(@(p,theta)int1(p,theta,mud,M,F),0,631,0,pi)-600;
出错 fsolve (第 264 行)
fuser = feval(funfcn{3},x,varargin{:});
出错 main (第 21 行)
x = fsolve(@tobesolve,[0,0,0])
原因:
Failure in initial objective function evaluation. FSOLVE cannot continue.
I wonder why M is undefined, although I have provided guess values and the same error does not affect mud.
And how to solve such equations with numeric integration in MATLAB.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Eigenvalue Problems finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!