MATLAB Answers

0

Simulink model 'to workspace' output

Asked by Mohsina Zafar on 4 Jul 2019
I am trying to control motor torque and am using a workspace variable in Simulink and want to output similar variable to workspace.
I have size(T_u)=[3, 91] whereas the output I am getting from the simulation has size [101, 90]
I am unable to understand why this is so.
Code that I am using:
load('Motor_Param.mat')
t = 1:0.1: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_PD = pid(100,0,10,100);
T_u = zeros(size(T_e));
for k=1:size(T_e,1)
T_u(k,:) = lsim(C_PD,T_e(k,:),t);
T_l = zeros(size(T_u));
C_PI = pid(10,1000,0);
a = sim('Motor_Control','SimulationMode','normal');
out = a.get('T_l')
end
.mat and .slx files are attached.

  0 Comments

Sign in to comment.

Products


Release

R2016a

0 Answers