- close all;
- figure(1);
- subplot(211);
- plot(out.tout,out.x(:,2),'r',out.tout,out.x(:,3),'b','linewidth',2);
- xlabel('time(s)');ylabel('position tracking');
- subplot(212);
- plot(out.tout,cos(t),'r',out.tout,out.x(:,3),'b','linewidth',2);
- xlabel('time(s)');ylabel('speed tracking');
- figure(2);
- plot(out.tout,out.f(:,1),'r',out.tout,out.f(:,3),'b','linewidth',2);
- xlabel('time(s)');ylabel('f approximation');
复制代码 出现的问题为:
错误使用 chap9_1plot (第 5 行)
位置 2 处的索引超出数组边界(不能超出 1)。
出现问题的代码为:
- plot(out.tout,out.x(:,2),'r',out.tout,out.x(:,3),'b','linewidth',2);
复制代码 所需的数据已上传,希望大佬能指出菜鸟新人的问题
|