Why Unrecognized function or variable 'set_point'?

2 ビュー (過去 30 日間)
Yusuf Hamzah
Yusuf Hamzah 2022 年 6 月 29 日
回答済み: Fangjun Jiang 2022 年 6 月 30 日
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 件のコメント
Yusuf Hamzah
Yusuf Hamzah 2022 年 6 月 30 日
i want to try find angular position dc motor control using state feedback
Walter Roberson
Walter Roberson 2022 年 6 月 30 日
What output did you get when you use the debugging steps that I suggested?

サインインしてコメントする。

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2022 年 6 月 30 日
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.

カテゴリ

Help Center および File ExchangeVariable Initialization についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by