Info

此问题已关闭。 请重新打开它进行编辑或回答。

Help needed for looping in simulink

1 次查看(过去 30 天)
Pranjal Bhatia
Pranjal Bhatia 2020-11-12
关闭: MATLAB Answer Bot 2021-8-20
So basically I have a matrix of size 4X4X640 and I have written a loop something like this :
for i = 1:640
qd = [A2(1,4,i);A2(2,4,i);0;A2(3,4,i)]';
qd_dot = [0;0;0;0]';
e=q'-qd; %Tracking Error
e_dot=q_dot'-qd_dot;
Tau=-(k1*e)-(k2*e_dot); % Controller
end
Here q is being genereated automatically by simulink using integrators and qd is my desired Trajectory. here Matrix A is 4x4x640. What I want is that in a timespan of 20 Seconds q-qd operation takes places and it generates a time varying error signal.
Right now the error is that qd is just taking the last value of the matrix size. What am I missing? q should be generated automatically but the size won't by 640. Should I convert it to a time series?

回答(0 个)

此问题已关闭。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by