Numerical integration with a variable integration limit
Ältere Kommentare anzeigen
Is there a way to implement the following:
f2=@(z) integral (@(x) f1(x,z) ,0 ,z);
P2=@(z) integral(f2,z,Inf);
With f2 and P2 as two separate anonymous functions? It seems z in f2 must be a scalar (not a vector), so a for loop is required to make multiple evaluations at z I can deal with that, but Matlab will not evaluate P2, giving the error: Error using integral (line 85) A and B must be floating-point scalars.
It appears that
P2Alt=@(z) integral2(@(x,z) f1(x,z), 0, z, z, Inf);
accomplishes the desired end result (z must be a scalar), but I would prefer the function f2, separate.
Antworten (2)
Kategorien
Mehr zu Programming 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!