To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016
I need to compute an integral inside a function. To compute an integral I use int function, first argument of which is the function to be integrated. I specify this function inside my big function
function y=b(s) y=b1*s+b2; end
all the other parameters are specified. What's wrong?
No products are associated with this question.
It really helps when you show what error you are getting and how you are calling the function at the command line. Give people a simple example so that they can reproduce your error.
int() expects symbolic variables, are you using symbolic variables here?
If not, look at the help for integral()
value = integral(@(x) 1/sqrt(2*pi)*exp(-x.^2./2),0,3)
Integral is for numerical integration. What are you expecting the result in?
Once you compute the symbolic integral use subs to evaluate the result:
Or use matlabFunction to convert the integrated function into a matlab function handle:
Ofcourse I am assuming that you know what the other parameters are.