PDA

View Full Version : question for integrals


theo23
27 Feb 2009, 11:18am
Hi,i have a question about quadgk and i need help.
I have an m-file with name integral which includes this function
function y=integral(E)
y= (1+exp(50000/1293*E+6250000/14223))*exp(-2*(10*E-1228/11)^2)

and one other m-file with this:
Q=quadgk(@integral,0,inf)
When i run it i have the following error.Where is the problem?

??? Error using ==> mpower
Matrix must be square.

Error in ==> integral at 2
y= (1+exp(50000/1293*E+6250000/14223))*exp(-2*(10*E-1228/11)^2)
Error in ==> quadgk>evalFun at 363
fx = FUN(x);

Error in ==> quadgk>f2 at 394
[y,too_close] = evalFun(t2t);

Error in ==> quadgk>vadapt at 275
[fx,too_close] = f(x);

Error in ==> quadgk at 222
[q,errbnd] = vadapt(@f2,interval);

Error in ==> oxi at 1
Q=quadgk(@integral,0,inf)

Thank you!!

shwaip
2 Mar 2009, 5:40pm
if you want to exponentiate or multiply (or do many other operations) elementwise, you need to use:


.*
.^
./

etc.

y= (1+exp(50000/1293*E+6250000/14223)).*exp(-2*(10*E-1228/11).^2)