![](https://csdnimg.cn/release/download_crawler_static/86625686/bg1.jpg)
MATLAB实例讲座
数据分析和统计
所有程序都在MATLAB V6.5中通过测试
![](https://csdnimg.cn/release/download_crawler_static/86625686/bg2.jpg)
数据分析和统计
在本章中将介绍M AT L A B对数据处理和统
计分析的命令。如果没有特别强调,本章中
的A和B是指m×n×. . .×p的多维矩阵,x是
一个向量。
¥.1最大值和最小值
![](https://csdnimg.cn/release/download_crawler_static/86625686/bg3.jpg)
数据分析和统计
例1.创建一个三维矩阵A:
>> A(:,:,1)=[1 2 3;2 3 1; 3 2 1]; >> A(:,:,2)=[2 4 6;4 6 2;6 4 2];
>> max(A) ans(:,:,1) = 3 3 3
ans(:,:,2) = 6 6 6 >> whos
Name Size Bytes Class
A 3x3x2 144 double array
ans 1x3x2 48 double array
Grand total is 24 elements using 192 bytes
![](https://csdnimg.cn/release/download_crawler_static/86625686/bg4.jpg)
求和、乘积和差分
数据分析和统计
求和
对例 . 1中的矩阵A进行求和及累计和,其操作如下:
>> TheSum=sum(A), TheCsum=cumsum(A)
TheSum(:,:,1) =
![](https://csdnimg.cn/release/download_crawler_static/86625686/bg5.jpg)
数据分析和统计
6 7 5 TheSum(:,:,2) = 12 14 10
TheCsum(:,:,1) =
1 2 3
3 5 4
6 7 5
TheCsum(:,:,2) =
2 4 6
6 10 8
12 14 10
评论0