Matlab矩阵处理小结(2)-读数据求均值和中位数 绘制errorbar图
2014-10-05 14:16
423 查看
files = dir('*.log');
for i=1:length(files)
File =files(i).name;
a=importdata(File);
b=reshape(a,6,12)';%calculate tramsportation to make std calculation easy
kth(:,:,i)=b;
end
for i=1:24
mymean=mean(kth(:,:,i));
mystd=std(kth(:,:,i));
mymedian=median(kth(:,:,i));
% myresult(:,:,1)=cat(2,myresult(:,:,1),mymean)
% myresult(:,:,2)=cat(2,myresult(:,:,2),mystd)
% a=cat(2,a,mymean);
% b=cat(2,b,mystd);
y(i,:)=mymean;
e(i,:)=mystd;
m(i,:)=mymedian;
end
y
e
m
fid=fopen('v1mean.txt','wt');
fprintf(fid,'%g\n',y);
fclose(fid);
fid1=fopen('v1mid.txt','wt');
fprintf(fid1,'%g\n',m);
fclose(fid1);
x=[1:1:24];
for i=1:6
subplot(2,3,i)
% figure('hello')
% text('Message transformation of Node v1')
% scatter(x,m(:,i),10,'Red');
plot(x,m(:,i),'RED')
hold on
errorbar(x,y(:,i),e(:,i));
% errorbar(x,y(:,i),1)
%title('type"i"')
xlabel('time');
ylabel('message');
switch i
case 1
title('type1')
case 2
title('type2')
case 3
title('type3')
case 4
title('type4')
case 5
title('type5')
case 6
title('type6')
end
end
for i=1:length(files)
File =files(i).name;
a=importdata(File);
b=reshape(a,6,12)';%calculate tramsportation to make std calculation easy
kth(:,:,i)=b;
end
for i=1:24
mymean=mean(kth(:,:,i));
mystd=std(kth(:,:,i));
mymedian=median(kth(:,:,i));
% myresult(:,:,1)=cat(2,myresult(:,:,1),mymean)
% myresult(:,:,2)=cat(2,myresult(:,:,2),mystd)
% a=cat(2,a,mymean);
% b=cat(2,b,mystd);
y(i,:)=mymean;
e(i,:)=mystd;
m(i,:)=mymedian;
end
y
e
m
fid=fopen('v1mean.txt','wt');
fprintf(fid,'%g\n',y);
fclose(fid);
fid1=fopen('v1mid.txt','wt');
fprintf(fid1,'%g\n',m);
fclose(fid1);
x=[1:1:24];
for i=1:6
subplot(2,3,i)
% figure('hello')
% text('Message transformation of Node v1')
% scatter(x,m(:,i),10,'Red');
plot(x,m(:,i),'RED')
hold on
errorbar(x,y(:,i),e(:,i));
% errorbar(x,y(:,i),1)
%title('type"i"')
xlabel('time');
ylabel('message');
switch i
case 1
title('type1')
case 2
title('type2')
case 3
title('type3')
case 4
title('type4')
case 5
title('type5')
case 6
title('type6')
end
end
相关文章推荐
- Matlab 矩阵处理小结(3)-将多个errorbar图像绘制到一个图像上
- ZCA白化(协方差矩阵变换成单位矩阵)和数据零均值处理
- MATLAB中如何在绘制条形图(bar graph)时,处理只有一组数据的颜色设置问题
- Matlab矩阵处理小结(4)-批量将矩阵保存到不同的文件--动态更新文件名
- matlab把cell矩阵转换成能处理的数据
- 如何在MATLAB画一个首尾相连的数据矩阵图形
- matlab 矩阵元素求和、求均值(期望)和均方差
- MATLAB和C++数据交类实例---矩阵操作
- Matlab生物信息学工具箱新增功能——处理GEO系列数据
- matlab数据文件的处理
- matlab中用imshow()显示图像与图像矩阵的数据类型的关系
- matlab处理txt文本文件---数据格式要有规律性,否则要用编写特定方式进行读取
- 图像处理 估计退化函数之运动模糊和矩阵matlab运算的一些实验情况
- 用Excel处理int矩阵数据,然后通过文本读取
- MatLab 自编的 均值滤波、中值滤波、高斯滤波 图像处理函数(转)
- matlab学习(1)——sparse函数和full函数处理稀疏矩阵
- matlab中用imshow()显示图像与图像矩阵的数据类型的关系
- 发个MatLab 自编的 均值滤波、中值滤波、高斯滤波 图像处理函数
- 发个MatLab 自编的 均值滤波、中值滤波、高斯滤波 图像处理函数
- 如何控制matlab中的数据输出格式? 改变输出位数精度