Integrating function that contains distribution
Show older comments
Hi! I need to integrate a function fun=u*F(Qu)*g(u) from 0 to 1. Where F is CDF of the normal distribution and g is the PDF of another one.
5 Comments
John D'Errico
on 29 Feb 2016
Edited: John D'Errico
on 29 Feb 2016
And so what is your question? You have stated your need. Are you asking us to do your work?
help integral
help int
Choose one, depending on whether you want to do a numerical or symbolic integration.
Yes, my comment may seem non-useful. But the fact is, we don't know who you are. We have no idea as to your skill/knowledge level about MATLAB, about mathematics in general. Do you not know what integration is? do you not know what the corresponding PDFs might be? Do you not know how to use the tools in MATLAB? Do you know what MATLAB is and how to use it period? The fact is, all of the above issues are ones that I have seen in people who might post something up here. How do we know what your problem is in this matter?
When you have an actual question, then ask it.
Torsten
on 9 Mar 2016
Q is a scalar ?
Best wishes
Torsten.
Torsten
on 10 Mar 2016
"quad" does not accept symbolic variables in the function definition. Thus Q has to be an explicit real number.
Try whether
Q=1;
fun=@(u,Q) u.*normcdf(u*Q,10,2); % this is what I try to integrate
quad(@(u) fun(u,Q),0,1)
works.
Best wishes
Torsten.
Answers (0)
Categories
Find more on Numerical Integration and Differentiation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!