Difficulty in implementing equations & performing Function Integration (Error First input argument must be a function handle.)

I have been trying to implement the following equations but am having a problem with their implementation especially the third equation, which involves integration and takes the output value from the second equation.
Function f(Zb) is the Gaussian probability density function with mean 0 and SD 1, and function F(Zb) is the equivalent cumulative normal probability function.
I am sharing my code kindly specify what exactly am I doing wrong.
[num1, text1, raw1] = xlsread('C:\Users\Hawkins\Desktop\Excel Data\Daily Mean Temperature (North Las Vegas_July_2010).xlsx');
[num2, text2, raw2] = xlsread('C:\Users\Hawkins\Desktop\Excel Data\Monthly Mean Temperature (North Las Vegas_2010).xlsx');
prompt = 'What is the Base Temperature Value? ';
Tb = input(prompt)
Td1 = num1(:,[2]);
Tm1 = num2(:,[2]);
Td = Td1';
Tm = Tm1';
Sd = std(Td);
Zb = (Tb - Tm)/Sd;
%function fZb = NPDF (Zb) %This function is called later in the code
%e1 = 1/(sqrt(2*pi));
%e2 = -(Zb.^2)/2
%fZb = e1 * exp(e2)
%end
NPDF (Zb)
fun = NPDF (Zb)
xmin = -Inf
xmax = Zb
q = integral(fun,xmin,xmax)

 Accepted Answer

Your integral equals
0.5*(1+erf(Zb/sqrt(2)))
No need to use "integral" in this simple case.
Best wishes
Torsten.

4 Comments

Thank you Torsten, but can you please elaborate how my integral equals to the equation which you have stated. Cause I still couldn`t figure it out
Read the paragraph
"Find cumulative distribution function of normal distribution"
under
Best wishes
Torsten.

Sign in to comment.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Asked:

on 14 Aug 2015

Commented:

on 14 Aug 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!