I used a Simulink PD model and used values:
P=100; D=10; N=100
The input I am giving is
[0;0;0]-[0.05*(10-t);0.04*(10-t);0.03*(10-t)] where t=1:10
I get numeric values from the simulation.
I am trying to implement the same in script file but I get answer in transfer function format. I want the answer to be in numeric form like that from Simulink, Here is my MATLab code:
for t = 1:10
T_d = [0;0;0];
T_o = [0.05*(10-t);0.04*(10-t);0.03*(10-t)];
T_e = T_d-T_o;
C = pid(100,0,10,100)
T_u=T_e*C
end
Kindly help me in this regard.
You need to use the lsim
function:
t = 1:0.01:10;
T_o = [0.05*(10-t);0.04*(10-t);0.03*(10-t)];
T_d = zeros(size(T_o));
T_e = T_d - T_o;
C = pid(100,0,10,100);
res = zeros(size(T_e));
for k=1:size(T_e,1)
res(k,:) = lsim(C,T_e(k,:),t);
end
plot(t,res)