i plotting normal curve using y = normpdf(x,mu,sigma);
in matlab. draws me normal curve. but, need additional information shown on curve, having vertical lines on curve show mu , sigma. similar one:
is there matlab function draw such vertical lines on curve?
thanks, aida
there no built-in function this, can hands:
create normal curve , plot it:
x = -2:0.05:2; mu = 0; sigma = 0.5; y = normpdf(x,mu,sigma); plot(x,y)
add lines sigmas:
hold on; plot( [mu - sigma mu - sigma],[0 max(y)],'--') plot( [mu + sigma mu + sigma],[0 max(y)],'--')
you can change sigma need (2sigma 3sigma). how add text? way:
text(0.1,-0.05,'mu + sigma');
or if want beautiful:
text(-0.65,-0.05,'\mu - \sigma')
result:
Comments
Post a Comment