Need to solve an singlevariable integral of functions of two variables, and get answers as functions

1 次查看(过去 30 天)
Hello and thanks
I've done this before, but now am getting an error like
Error using integralCalc/finalInputChecks (line 522)
Input function must return 'double' or 'single' values. Found 'sym'.
Error in integralCalc/iterateScalarValued (line 315)
finalInputChecks(x,fx);
Error in integralCalc/vadapt (line 132)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 103)
[q,errbnd] = vadapt(@minusInfToInfInvTransform,interval);
when doing
Sol_Mex_P_22 = @(J) abs(integral(@(t) K_mex_p(t).*CC22(t,J),-Inf,Inf));
what is wrong??
thanks!

回答(1 个)

Matt J
Matt J 2020-5-6
This function
@(t) K_mex_p(t).*CC22(t,J)
needs to return a numeric value for every given t. It is returning a symbolic value, however.
  2 个评论
Ori Iger
Ori Iger 2020-5-6
Thanks! I understood that, but how can I solve the integral solely depending on t (from -info to inf so no t remains), and get the answer only as function of J?
I actually did this already, with this same integral function, and it worked great actually. Maybe the J dependence of CC22 is too complicated this time? Uri
Matt J
Matt J 2020-5-6
No, the failure here is because CC22 is a symbolic expression or a symbolic value for J was given as input. All variables participating in this computation must be non-symbolic. If you need to do symbolic integration, then you would use int,

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by