Integration with negative support
Mostrar comentarios más antiguos
Hi, I would like to integrate something like this
z=@(x) x<0;
integral(exppdf(z,10),-0.5, 0.5);
Any help will be useful. Thanks
Respuestas (1)
Rik
el 21 de Feb. de 2017
You are aware that you are not creating a bound, but a function that says that z is either 1 or 0?
And that there is a vital difference between integrate() and integral()?
Anyway, I copied out the function that exppdf calculates from its help, which resulted in the code below:
mu=10;
z=@(x) (1/mu)*exp(-x/mu);
integral(z,-0.5, 0.5);
4 comentarios
Nikolas
el 21 de Feb. de 2017
Rik
el 21 de Feb. de 2017
Sure, but not if you are integrating for x from -0.5 to 0.5
integral(z,-0.5, 0);
Nikolas
el 21 de Feb. de 2017
Rik
el 21 de Feb. de 2017
Why do you want to use this function? And if you use exppdf as an input, the integral for 0 to 0.5 should not be 0. There is another thing that may be what you mean:
z2=@(x) exppdf(-x,mu);%turn positive x into negative and vice versa
This will return 0 for integral(z2,0,0.5)
Categorías
Más información sobre Mathematics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!