Why Unrecognized function or variable 'set_point'?

2 visualizzazioni (ultimi 30 giorni)
Yusuf Hamzah
Yusuf Hamzah il 29 Giu 2022
Risposto: Fangjun Jiang il 30 Giu 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 Commenti
Yusuf Hamzah
Yusuf Hamzah il 30 Giu 2022
i want to try find angular position dc motor control using state feedback
Walter Roberson
Walter Roberson il 30 Giu 2022
What output did you get when you use the debugging steps that I suggested?

Accedi per commentare.

Risposte (1)

Fangjun Jiang
Fangjun Jiang il 30 Giu 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.

Categorie

Scopri di più su Variable Initialization in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by