matlab计算平均值,数据波动标准差,多数据出一图C1 = 428,BZC1 = 24,C2 = 487,BZC2 = 26,C3 = 532,BZC3 = 35C4 = 607,BZC4 = 48

clc;clear all;close all
X1=xlsread('F:\celiyi\Exports\g10.xlsx',4);
A1=X1(:,8);B1=X1(:,9);F1=X1(:,1);G1=X1(:,1);
C1=[A1,B1];
D1=C1';%%看D1
e1= D1(:);
n1=length(e1);
d1=-(e1(1,:)+e1(2,:))/2;
N1 = repmat(d1, 1, n1);
N1=N1';
E1=e1+N1;
H1=[F1,G1];
H1=H1';
i1= H1(:);
m1=length(i1);
M1= repmat(1.5, 1,m1);
M1=M1';
I1=i1+M1;
G1=[I1,E1];
idx = find(G1(:,1)<0 | G1(:,1)>10);  
G1(idx,:) = [];
B1=E1(38:160,:);%%找E1里面稳定的位置
C1=mean(B1)%%求平均
%%波动
x_FangCha4=sum((B1-C1).^2,1)/(size(B1,1)-1);%样本方差
BZC1=sqrt(x_FangCha4)%样本标准差
line([0,10],[C1,C1],'color','r')
hold on
axis([0,10,0,800])
% plot(G1(:,1),G1(:,2));
%%
X2=xlsread('F:\celiyi\Exports\g14.xlsx',4);
A2=X2(:,8);B2=X2(:,9);F2=X2(:,1);G2=X2(:,1);
C2=[A2,B2];
D2=C2';%%看D2
e2= D2(:);
n2=length(e2);
d2=-(e2(1,:)+e2(2,:))/2;
N2 = repmat(d2, 1, n2);
N2=N2';
E2=e2+N2;
H2=[F2,G2];
H2=H2';
i2= H2(:);
m2=length(i2);
M2= repmat(1.7, 1,m2);%%看E2
M2=M2';
I2=i2+M2;
G2=[I2,E2];
idx = find(G2(:,1)<0 | G2(:,1)>10);  
G2(idx,:) = [];
B2=E2(30:121,:);%%找E2里面稳定的位置
C2=mean(B2)%%求平均
%%波动
x_FangCha4=sum((B2-C2).^2,1)/(size(B2,1)-1);%样本方差
BZC2=sqrt(x_FangCha4)%样本标准差
line([0,10],[C2,C2],'color','g')
hold on
axis([0,10,0,800])
% plot(G1(:,1),G1(:,2),'r',G2(:,1),G2(:,2),'g');
%%
X3=xlsread('F:\celiyi\Exports\g16.xlsx',4);
A3=X3(:,8);B3=X3(:,9);F3=X3(:,1);G3=X3(:,1);
C3=[A3,B3];
D3=C3';%%看D1
e3= D3(:);
n3=length(e3);
d3=-(e3(1,:)+e3(2,:))/2;
N3 = repmat(d3, 1, n3);
N3=N3';
E3=e3+N3;
H3=[F3,G3];
H3=H3';
i3= H3(:);
m3=length(i3);
M3= repmat(1.55, 1,m3);%%看E3i3修改
M3=M3';
I3=i3+M3;
G3=[I3,E3];
idx = find(G3(:,1)<0 | G3(:,1)>10);  
G3(idx,:) = [];
B3=E3(30:103,:);%%找E3里面稳定的位置修改
C3=mean(B3)%%求平均
%%波动
x_FangCha4=sum((B3-C3).^2,1)/(size(B3,1)-1);%样本方差
BZC3=sqrt(x_FangCha4)%样本标准差
line([0,10],[C3,C3],'color','b')
hold on
axis([0,10,0,800])
% plot(G1(:,1),G1(:,2),'r',G2(:,1),G2(:,2),'g',G3(:,1),G3(:,2),'b');
%%
X4=xlsread('F:\celiyi\Exports\g15.xlsx',4);
A4=X4(:,8);B4=X4(:,9);F4=X4(:,1);G4=X4(:,1);
C4=[A4,B4];
D4=C4';%%看D1
e4= D4(:);
n4=length(e4);
d4=-(e4(1,:)+e4(2,:))/2;
N4= repmat(d4, 1, n4);
N4=N4';
E4=e4+N4;
H4=[F4,G4];
H4=H4';
i4= H4(:);
m4=length(i4);
M4= repmat(1.65, 1,m4);%%看E3i3修改
M4=M4';
I4=i4+M4;
G4=[I4,E4];
idx = find(G4(:,1)<0 | G4(:,1)>10);  
G4(idx,:) = [];
B4=E4(26:85,:);%%找E4里面稳定的位置修改
C4=mean(B4)%%求平均
%%波动
x_FangCha4=sum((B4-C4).^2,1)/(size(B4,1)-1);%样本方差
BZC4=sqrt(x_FangCha4)%样本标准差
line([0,10],[C4,C4],'color','c')
hold on
axis([0,10,0,800])
plot(G1(:,1),G1(:,2),'r',G2(:,1),G2(:,2),'g',G3(:,1),G3(:,2),'b',G4(:,1),G4(:,2),'c');

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值