Why is the mean function not working?
Show older comments
clc
x=randn(1,100000);
y=randn(1,100000);
Za=x+10;
[f,x]=hist(Za,100); %Simulated PDF
bar(x,f/trapz(x,f));
hold on;
title('normalized histogram');
ym = mean(Za)
yv = var(Za)
2 Comments
per isakson
on 5 May 2018
Edited: per isakson
on 5 May 2018
What do you mean by "function not working"?
Here, R2016a, your code works according to my expectations.
dpb
on 5 May 2018
Sometime you've probably inadvertentedly written mean on the LHS and aliased the function...see what
which mean
returns and try
clear mean
and see if symptoms don't disappear. (The new Crystal Ball Toolbox)
Accepted Answer
More Answers (0)
Categories
Find more on Uniform Distribution (Continuous) 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!