📄 e1092.m
字号:
%-----------------------------------------------------------------------
% Example 10.9.2: Flag Pole Motion
%-----------------------------------------------------------------------
% Initialize
clc % clear screen
clear % clear variables
n = 0; % number of past outputs
m = 20; % number of past inputs
r = n + m + 1;
theta = zeros (r,1); % parameters
x = zeros (r,1); % states
% Get input/output data: t, u, y
fprintf ('Example 10.9.2: Flag Pole Motion\n');
data1092 % get data
p = length(y);
Y = zeros (p,2);
Y(:,1) = y;
% Identify MA model and compare responses
theta = getarma (u,y,n,m);
show ('theta',theta)
for i = 1 : p
[x,Y(i,2)] = arma (u(i),theta,x,n,m);
end
graphxy (t,Y,'Responses','t (sec)','y (cm)')
% Write theta to file
f = fopen ('theta.dat','w');
q = fix(r/2);
for i = 1 : q
j = q + 1 + i;
fprintf (f,'%i & %.3f & %i & %.3f \\\\ \n', ...
i,theta(i),j,theta(j));
end
fprintf (f,'%i & %.3f & & \\\\ \n',r/2+1,theta(q+1));
%-----------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -