1. 程式人生 > >matlab畫圖

matlab畫圖

% file = 'E:\matlabtest\1.xls';  
% data = xlsread(file); 
data=load('C:\Users\Administrator\Desktop\d.TXT');
T=size(data);
tt=0.02;
t=0:tt:((T(1,1)-1)*tt);


dt1=(1:1:(T-1))';
dt2=(2:1:T)';
dPs=data(dt2,1)-data(dt1,1);


dPs=[0
    dPs];


subplot(4,1,1);
plot(t,data(:,1),'-b');


xlabel('time/s');  
ylabel('Press/Pa');  
title('P vs time'); 
grid on;


subplot(4,1,2);
plot(t,data(:,2),'-r');
xlabel('time/s');  
ylabel('Temp/℃');  
title('T vs time'); 
grid on;


subplot(4,1,3);
plot(t,data(:,3),'-g');
xlabel('time/s');  
ylabel('Hight/m');  
title('H vs time'); 
grid on;


subplot(4,1,4);
plot(t,dPs,'-y');
xlabel('time/s');  
ylabel('P(K)-P(K-1)/Pa');  
title('P(K)-P(K-1) vs time'); 
grid on;


TsMax=max(data(:,2));
TsMin=min(data(:,2));
Ts_PP=TsMax-TsMin


PsMax=max(data(:,1));
PsMin=min(data(:,1));
Ps_PP=PsMax-PsMin


HMax=max(data(:,3));
HMin=min(data(:,3));
H_PP=HMax-HMin


std(data(:,1))
std(data(:,2))
std(data(:,3))