Syntax help with script
Show older comments
I am wanting to put this equation into matlab, but I am having problems.
I am wanting to find the standard deviation without the built in matlab function. I have a mean_temp and a mean_pres already set up and displaying properly. Can I get some help how to incorporate those values (i have i=1:30) for each temp and pressure.
The standard deviation equation is:
(sum i=1 to n (xi^2-nxbar^2))/(n-1)
My xi should be my values each 1 through 30. xbar is my mean.
Thank you in advance.
Accepted Answer
More Answers (1)
Greg
on 20 Jun 2013
0 votes
1 Comment
John
on 20 Jun 2013
oh sorry, I was assuming i was the length of your vector x. If you want the standard deviation of "temperature", then you would just do:
sum((temperature-mean(temperature)).^2)/size(temperature,1)
assuming temperature has i rows and 1 column. No for-loop is necessary.
Categories
Find more on Matrix Indexing 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!