Integral of a product between a function and a Cumulative Normal Distribution
Show older comments
Hi.
I need to compute an integral of a function that consist in the product between a Cumulative distribution of a Normal, and another term.
I tried using the command int, but in that case I was not able to execute the normcdf command.
Matlab said: CNaux2=normcdf(aux5) Error using NaN Trailing string input must be 'single' or 'double'.
Instead, i tried using the quad command. In that case, the normcdf could be defined as a function handle, but then i coul not excute the quad command. In this case matlab said
Error using * Inner matrix dimensions must agree.
And i don´t understand why, because i don´t have any matrix here, i have only a product of functions of one variable.
Could you please help me?
Thanks! Javier
Accepted Answer
More Answers (1)
Youssef Khmou
on 27 Mar 2013
Edited: Youssef Khmou
on 27 Mar 2013
hi,
I am no sure about the error you get, but try this version :
m=0;
s=1;
x=0:0.1:10;
C=normcdf(x,m,s);
PHI=2*exp(j*2*pi*x); % Consider it as wave function
N=abs(PHI).^2; % consider it as the probability of existence .
b=exp(-(x-2).^2);; % the thrid function as you consider
II=C.*b.*N;
figure, plot(x,II);
F=trapz(x,II);
So the integral is evaluated using the function "trapz" along the X axis ,
I hope this helps
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!