如何调试以下Matlab代码?

如何调试以下Matlab代码?,matlab,parameters,estimation,Matlab,Parameters,Estimation,错误 文件:参数\u估算\u 1.m行:8列:10 意外的MATLAB表达式 当我运行以下MATLAB代码时出现: T = 0:0.25:5; % time vector (row) T = T'; % time vector (column) seed = [3;0.5]; % seed for noise generation randn('state',seed); % using the same seed each time uu = 0.5 1 0.25*randn(length(T

错误

文件:参数\u估算\u 1.m行:8列:10

意外的MATLAB表达式

当我运行以下MATLAB代码时出现:

T = 0:0.25:5; % time vector (row)
T = T'; % time vector (column)
seed = [3;0.5]; % seed for noise generation
randn('state',seed); % using the same seed each time
uu = 0.5 1 0.25*randn(length(T),1); % mean of 0.5 with variance
% of 0.25
U = 2*round(uu)-1; % creates PRBS with -1 and 1 values %
sim('est_vdv'); % runs simulation of linear van de vusse % diagram
figure(1); % plot input-output data
subplot(2,1,1),plot(tp,yp,'k',t,y,'ko');
xlabel('time, min'), ylabel('y')
title('PRBS estimation example')
subplot(2,1,2),plot(tp,up,'k'); xlabel('time, min'),ylabel('u')
axis([0 5 -1.1 1.1])
% % generate phi matrix for estimation
for j = 4:22;
phi(j-3,:) = [y(j-2) y(j-3) u(j-2) u(j-3)];
end
%
theta = inv(phi'*phi)*phi'*y(3:21) % estimate parameters
num = [theta(3) theta(4)]; % numerator of discrete transfer function
den = [1 -theta(1) -theta(2)]; % denominator of discrete transfer function
sysd = tf(num,den,0.25) % create discrete tf object
tzero(sysd) % calculate zeros
pole(sysd) % calculate poles
syszpk = zpk(sysd) % zero-pole-k form
该代码应该与名为“est_vdv”的SIMULINK模型一起运行,以估计模型的参数。
我应该如何处理这个错误?

谢谢朋友们的建议,我已经能够找出第五行的错误,应该是

uu=0.5+0.25.*randn(length(T),1)

抱歉,错误地指出错误在第8行。

您是指这一行吗?
子地块(2,1,1),绘图(tp,yp,'k',t,y,'ko')有一个彗差而不是分号,这一个:
uu=0.510.25*randn(长度(T),1)?(缺少括号)一般来说,大多数堆栈溢出用户都不太喜欢问题——你应该学会捕捉自己的问题,在这种情况下,你应该学会调试自己的代码。对于这样的脚本,只需逐行遍历代码,直到出现错误。然后,如果仍然不清楚问题是什么,将出错的代码行分解为各个部分并执行每个部分,直到错误弹出。然后,如果还不清楚问题出在哪里,请查阅每个组成函数的手册。Rody,如果你不想帮忙,请走开。还有很多人会非常乐意帮忙。