Calculating the Standard Deviation
6 次查看(过去 30 天)
显示 更早的评论
Hi,
How to read each value from a txt file for calculation of standar deviation (SD).
For example, I have my txt file with Y values (frequencies) and I want to caulate how much of variation from the mean the frequencies change. I can do it manually but for many data this would be too slow process. So, I want to automatically read and calculate the SD.
My file has jus one colum. To calculate the SD I have to calculate mean first, so would be: Mean = A/n
The variable A would be the sum of each value in my file divivded by the total number of values. Attached is the file. Then, I can calculate the SD which is
the sqr((A(1)-Mean)^2 + (A(2)-Mean)^2 + ... + (A(N)-Mean)^2/n-1).
Is there a way to do it automatic?
Thank you
采纳的回答
Star Strider
2021-5-5
y = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/608245/y%20axis.txt')
ymean = mean(y)
stdvct = sqrt((y-ymean).^2)
[N,C,S] = normalize(y,'center','mean')
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!