How can I integrate a function that has more than 1 input?

This question might be very simple but I'm very frustrated that I cant make this work. I'm trying to integrate a function that is called like this:
d=dsACst(x,zeta,nu)
where zeta and nu are known constants and I want to integrate the function using x as the variable, like this
fun=@(x)dsACst
q=integrate(fun,0,Inf)
but I get the following error:
Not enough input arguments.
Error in dsACst (line 25)
pdf=o_tpdf(x,nu);
I can tell that when the integral is calculated the values of zeta and nu are not being read (or used) How can I fix this problem? Or maybe I'm doing something else wrong.

1 Comment

function ds=dsACst(x, zeta, nu)
pdf=o_tpdf(x,nu);
cdf=o_tcdf(zeta*x.*sqrt((nu+1)./(x.*x+nu)),(nu+1));
ds=2*pdf.*cdf;
end
The o_tpdf and o_tcdf functions are equal to the tpdf and tcdf matlab functions I have just changed the names because of my boss requested, but the functions are not altered.

Sign in to comment.

 Accepted Answer

fun = @(x)dsACst(x,zeta,nu)
q = integral(fun,0,Inf)
Best wishes
Torsten.

More Answers (0)

Asked:

on 12 Dec 2017

Edited:

on 12 Dec 2017

Community Treasure Hunt

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

Start Hunting!