Reputation: 9823
I want to integrate this function in terms of dx in matlab. Is there a function to do it?
f = inline('(k/l)*((x/l)^k-1)*(exp(-1*((x/l)^k)))','x','l','k');
Upvotes: 0
Views: 1408
Reputation: 33
I think in the answer above, it should be
value = integral(f,a,b);
instead of value = integral(@f,a,b);
Upvotes: 0
Reputation: 3914
The inline
function is depreciated. You should instead use anonymous functions. Assuming k
and l
are constants:
f = @(x) (k/l)*((x/l).^k-1).*(exp(-1*((x/l).^k)));
From there, there are any number of available numerical integration functions. I would start with integral
and then work my way down.
value = integral(@f,a,b);
Upvotes: 2