MATLAB: Hello, I am getting an error un the following code, can someone solve it,

normcdf

x = 40.25:0.1:74.75;
mu = 57.5;
sigma = 2.875;
r=normrnd(mu,sigma,10);
p = normcdf(x,r);
plot(x,p)

Best Answer

"i wanted to generate the 1000 random sample so, how will i do that"
To generate 1000 random samples from a normal distribution with known mean and standard deviation,
r=normrnd(mu,sigma,1,1000); % for an output with size 1,1000
r=normrnd(mu,sigma,1000,1); % for an output with size 1000,1
The normcdf() function will return the cumulative distribution function evaluated at each value of 'x' in the first input so the output (p) will have the same size as the first input (x).
Perphas this is what you're looking for.
p = normcdf(x,mu,sigma);