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

1 view (last 30 days)
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!

Answers (1)

Matt J
Matt J on 6 May 2020
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 Comments
Ori Iger
Ori Iger on 6 May 2020
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 on 6 May 2020
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,

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!