当前位置:网站首页>matlab习题 —— 数据的基本处理
matlab习题 —— 数据的基本处理
2022-06-28 02:18:00 【繁依Fanyi】
matlab系列文章:目录

一、题目
读取附件sd.xlsx,计算数据如下统计量:
- 均值
- 方差
- 标准差
- 最大值
- 最小值
- 极差
- 中位数
- 分位数
- 众数
- 变异系数
- 原点矩
- 中心距
- 偏度
- 峰度 (以上计算sd中第一列)
- 第一列和第二列数据的协方差和相关系数
资源链接:https://download.csdn.net/download/qq_21484461/85801116?spm=1001.2014.3001.5503
二、解答
1. 读取数据
>> [num1]=xlsread('F:\sd.xlsx',1,'A1:B191') %读取前1、2列
>>
>> [num2]=xlsread('F:\sd.xlsx',1,'D1:E191') %读取前4、5列
>>
>> [num3]=xlsread('F:\sd.xlsx',1,'G1:H40') %读取前7、8列
2. 求均值
>> mean(num1(:,[1]))
ans =
2.9634
3. 求方差
>> var(num1(:,[1]))
ans =
0.9337
4. 求标准差
>> std(num1(:,[1]))
ans =
0.9663
5. 求最大值
>> max(num1(:,[1]))
ans =
6.4000
6. 求最小值
>> min(num1(:,[1]))
ans =
0.5000
7. 求极差
>> max(num1(:,[1]))-min(num1(:,[1]))
ans =
5.9000
8. 求中位数
>> median(num1(:,[1]))
ans =
2.8000
9. 求分位数
>> prctile(num1(:,[1]),40) %40分位数
ans =
2.5000
10. 众数
>> mode(num1(:,[1]))
ans =
2.2000
11. 变异系数
>> std(num1(:,[1]))/mean(num1(:,[1]))
ans =
0.3261
12. 原点矩
>> sum(num1(:,[1]).^2)/length(num1(:,[1])) %2阶原点矩
ans =
9.7103
或
>> mean(num1(:,[1]).^2)
ans =
9.7103
13. 中心距
>> for i = 1:length(num1(:,[1]))
x1(i) = num1(i) - mean(num1(:,[1]))
end
>>
>> mean(x1.^2)
ans =
0.9288
14. 求偏度
>> skewness(num(:,[1]))
ans =
0.3339
14. 峰度
>> kurtosis(num(:,[1]))
ans =
2.9240
15. 第一列和第二列数据的协方差和相关系数
① 协方差
第一列:
>> cov(num1(:,[1]))
ans =
0.9337
第二列:
>> cov(num1(:,[2]))
ans =
5.3527
协方差矩阵
>> cov(num1(:,[1]),num1(:,[2]))
ans =
0.9337 0.3703
0.3703 5.3527
② 相关系数
>> corr(num1(:,[1]),num1(:,[2]))
ans =
0.1656

边栏推荐
- 剑指 Offer 47. 礼物的最大价值(DP)
- CMU puts forward a new NLP paradigm - reconstructing pre training, and achieving 134 high scores in college entrance examination English
- 论文阅读:Generative Adversarial Transformers
- "Everyday Mathematics" serial 53: February 21
- 文件的相对路径写法
- Is it reliable to invest in the inter-bank certificate of deposit fund? Is the inter-bank certificate of deposit fund safe
- 嵌入式DSP音频开发
- 暴雨去哪儿?天气预报不准谁的锅?
- Agileplm exception resolution session
- Thesis reading: General advantageous transformers
猜你喜欢

collections.defaultdict()的使用

拾光者,云南白药!

栈的基本操作(C语言实现)

2022危险化学品经营单位安全管理人员特种作业证考试题库模拟考试平台操作

为什么OpenCV计算的帧率是错误的?

Build your own website (17)

Is your IOT security strong enough?

Tips for visiting the website: you are not authorized to view the recovery method of this page

测试要掌握的技术有哪些?软件测试必懂的数据库设计大全篇

分布式事务解决方案Seata-Golang浅析
随机推荐
论文阅读:Generative Adversarial Transformers
嵌入式软件开发中必备软件工具
service实现类里面为何一直报红
2022危险化学品经营单位安全管理人员特种作业证考试题库模拟考试平台操作
Heartless sword English Chinese bilingual poem 004 Meditation
导致系统性能失败的十个原因
RichView TRVStyle
PSM summary
How to write concise code? (upper)
Is online stock investment exchange group safe? Is it reliable to open an account for free?
[games] Parkour
测试要掌握的技术有哪些?软件测试必懂的数据库设计大全篇
Arduino esp8266 web LED control
Severe Tire Damage:世界上第一个在互联网上直播的摇滚乐队
be fond of the new and tired of the old? Why do it companies prefer to spend 20K on recruiting rather than raise salaries to retain old employees
微信小程序中生成二维码
ARM Development Studio build编译报错
剑指 Offer 49. 丑数(三指针法)
Opencv -- geometric space transformation (affine transformation and projection transformation)
Is it safe to buy stocks and open an account through the account opening link of the broker manager? Want to open an account for stock trading