Why Unrecognized function or variable 'set_point'?

2 visualizaciones (últimos 30 días)
Yusuf Hamzah
Yusuf Hamzah el 29 de Jun. de 2022
Respondida: Fangjun Jiang el 30 de Jun. de 2022
clear;clc;close all;
A = [0 1 0 ; 0 -10 7.5; 0 -0.15 2];
B = [0;0;2];
C = [1 0 0];
J = [-5 -5 -5];
K = acker(A,B,J);
KK = [0 K(2) K(3)];
k1 = K(1);
sim('simulation_of_dc_motor_control')
sp = set_point(:,1);
y = angular_position(:,1);
t = time_data(:,1);
figure
hold on;grid on;
plot(t,sp,t,y,'linewidth',2)
legend('set point','angular position')
stepinfo(y,t,sp(1))
sse = abs(sp(end)-y(end));
fprint('Steady State Error = %d \n',sse);
Hi, i've some trouble here, Here is my code, i got error "Unrecognized function or variable 'set_point'."
I make the simulink before and try to connect it to my script but i think it doesnt connect well.
Here is my block in simulink
How to solve it?
Thanks
  3 comentarios
Yusuf Hamzah
Yusuf Hamzah el 30 de Jun. de 2022
i want to try find angular position dc motor control using state feedback
Walter Roberson
Walter Roberson el 30 de Jun. de 2022
What output did you get when you use the debugging steps that I suggested?

Iniciar sesión para comentar.

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 30 de Jun. de 2022
The variable that you are looking for, "set_point",is in "out.set_point".
So, in your code, replace "set_point" with "out.set_point". You may also need to change it to "out.set_point.Time" and "out.set_point.Data" because the data is not saved as "Array" but "timeseries".
This is impacted by settings at "Configuration Parameters", "Data Import/Export". The "Single simulation output" must have been checked so the "To Workspace" block variable automatically becomes "out.set_point".
If you use sim(), you need to give it a return variable like, xyz=sim('ModelName'), then your variable is in "xyz.set_point".
The "Data Import/Export" has been changed quite a lot from old days. Play with it manually first to figure it out and then write your code.

Categorías

Más información sobre Variable Initialization en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by