testdata = load('text.txt')
plot(testdata) % 1ms per data
plot(0:0.1:(length(testdata)-1)*0.1,testdata) % 0.1ms per data
>> figure(2)
>> plot(0:0.1:(length(testdata)-1)*0.1,testdata)
>> grid on
>>
function[]=plot_en()
disp('------------------------------------------------------------------');
disp('Plots the Energy balance');
load envar.dat;
load timevar.dat;
EN=envar;T=timevar;
set(0,'DefaultLineLineWidth',1.5)%默认线条粗细
fh1=figure('Name','Energy Balance','NumberTitle','off');%取消figur图编号
subplot(2,1,1)%窗口划分为两行一列,第一个
set(fh1, 'color', 'white'); % figur背景设为白色
plot(T,EN(:,1),'-r',T,EN(:,4),'-.m');%plot数据
set (gca,'fontsize',10,'fontweight','n','fontname','times new romans','linewidth',0.5,'Box', 'off','TickDir','out' );
% 刻度字体大小 刻度线条粗细
% 图框闭合成Box-on,off 不闭合 刻度线向里-in,out向外
%title(' ENERGY BALANCE OF SIMULATION THROUGH LSIM ','FontSize',8); %标题名
xlabel('time (s)','FontSize',10); %X轴单位,字体大小
ylabel('Energy (J)','FontSize',10); %Y轴单位,字体大小
h=legend('Potential','Total'); %线型标识名
set(h,'Orientation','horizontal','Color', 'c','Box', 'on','Location','best','fontsize',10,'fontweight','n','fontname','times new romans','linewidth',2.5)
% 对线型标识名legend的设置---蓝绿色C背景box包围打开-on,关闭-off ;位置自动最佳;legend字体大小10;box线框粗细2.5
% plot常用颜色,r 红,g 绿,b 蓝,c 蓝绿,m 紫红,y 黄,k 黑,w 白;color阈值[1 0 0]--代表红色
subplot(2,1,2)%%窗口划分为两行一列,第2个
set(fh1, 'color', 'white'); % sets the color to white
plot(T,EN(:,2),T,EN(:,3));
set (gca,'fontsize',10,'fontweight','n','fontname','times new romans','linewidth',0.5,'Box', 'on','TickDir','in' );
% title(' ENERGY BALANCE OF SIMULATION THROUGH LSIM ','FontSize',8);
xlabel('time (s)','FontSize',10);
ylabel('Energy (J)','FontSize',10);
h=legend('Kinetic','Actuator');
set(h,'Orientation','horizontal','Color', 'none','Box', 'off','Location','best','fontsize',10,'fontweight','n','fontname','times new romans','linewidth',0.5)
% legend位置northoutside,外-北;'north' | 'south' | 'east' | 'west' |'northeast' | 'northwest' | 'southeast' | 'southwest' | 'northoutside' |
%'bestoutside'|'northeast' | 'northwest' | 'southeast' | 'southwest' | 'northeastoutside' |
%'northwestoutside' | 'southeastoutside' | 'southwestoutside'
```<!--autointro-->