- #1
strokebow
- 123
- 0
Hi,
I have a MATLAB function m file and I want to integrate the function.
Then when I call the integration in MATLAB I don't know how to specify a and b whilst integrating over t.
I need to be able to set a and b outside of the function m file and then call the integral.
R=quadgk(@myfun,0,Inf)
This command will not work. a and b need to be set. I want to set a and b (this can vary) and then run the integral. I have tried set a and b in the MATLAB workspace but that still doesn't work.
Please can anyone help?
** Also, please let me know if my explanation is not clear?
Thanks
I have a MATLAB function m file and I want to integrate the function.
Code:
function y = myfun(t,a,b)
y = (1/(2*pi)).*(1./t)*(1i*(a+b));
end
I need to be able to set a and b outside of the function m file and then call the integral.
R=quadgk(@myfun,0,Inf)
This command will not work. a and b need to be set. I want to set a and b (this can vary) and then run the integral. I have tried set a and b in the MATLAB workspace but that still doesn't work.
Please can anyone help?
** Also, please let me know if my explanation is not clear?
Thanks
Last edited: