Info

This question is closed. Reopen it to edit or answer.

Help needed for looping in simulink

1 view (last 30 days)
Pranjal Bhatia
Pranjal Bhatia on 12 Nov 2020
Closed: MATLAB Answer Bot on 20 Aug 2021
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?

Answers (0)

Community Treasure Hunt

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

Start Hunting!