Issue with InputVisibility for lsimplot

조회 수: 12 (최근 30일)
Hannes
Hannes 대략 18시간 전
편집: Star Strider 대략 17시간 전
I am trying to generate a plot of a response of a StateSpace System (1 Input, 5 Outputs, with Outputs 2,3 and 4 of interest) to an predefined input. When using the lsimplot() function, it automatically displays the input in every subplots what makes it quiet hard to see the acutal response at its magnitude is significantly smaller.
To avoid removing it each time manually in the figure, i tried to manipulate the InputVisible-Option.
figure(1)
plot1 = lsimplot(dyn_sys(2:4),u_sim,t_sim);
plot1.InputVisible = {'off'}
But in this case the response is not plotted at all (emtpy figure, only showing the axis labels). Any other syntax like
plot1.InputVisible = 'off'
or
plot1.InputVisible = false
resulted in an Error when running the file.
"Cell array of character vectors may only contain character vectors and numeric matrices.
Error in XXX
plot1.InputVisible = 'off' "
Note: I recognised that the by default the "InputVisible"-Parameter is not "on" or "true" as I expected but empty.
Has anybody encountered the same problem and knows how to resolve it?

답변 (1개)

Star Strider
Star Strider 대략 2시간 전
편집: Star Strider 대략 2시간 전
It would probably help to have the omitted parts of your code.
What you want to do works here (R2025b).
A work-around would be to recover the data you want, and plot it separately. In order to get that information, it will be necessary to dive deeply into the lsimplot properties.
Using an example from the lsimplot documentation, this shows one approach --
A = [-2-2i -2;1 0];
B = [2;0];
C = [0 0.5+2.5i];
D = 0;
sys = ss(A,B,C,D);
figure
[u,t] = gensig("square",4,12);
lp = lsimplot(sys,u,t);
lp.InputVisible='off';
figure
[u,t] = gensig("square",4,12);
lp = lsimplot(sys,u,t);
% get(lp)
Kids = lp.Children;
% get(Kids)
GKids = Kids.Children;
% get(GKids)
GGKids = GKids.Children;
% get(GGKids)
GGGKids = GGKids.Children
GGGKids =
5×1 graphics array: Line (SimulationResponseLine) Line (TimeImaginaryResponseLine) Patch (TimeImaginaryMarkerPatch) Line (TimeMagnitudeResponseLine) Line (SimulationInputLine)
Line1 = GGGKids(1)
Line1 =
Line (SimulationResponseLine) with properties: Color: [0.0660 0.4430 0.7450] LineStyle: '-' LineWidth: 0.5000 Marker: 'none' MarkerSize: 6 MarkerFaceColor: 'none' XData: [0 0.0625 0.1250 0.1875 0.2500 0.3125 0.3750 0.4375 0.5000 0.5625 0.6250 0.6875 0.7500 0.8125 0.8750 0.9375 1 1.0625 1.1250 1.1875 1.2500 … ] (1×193 double) YData: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0023 0.0100 0.0243 0.0458 0.0746 0.1104 0.1529 0.2013 0.2547 0.3122 … ] (1×193 double) Use GET to show all properties
Line3 = GGGKids(4)
Line3 =
Line (TimeMagnitudeResponseLine) with properties: Color: [0.0660 0.4430 0.7450] LineStyle: '-' LineWidth: 0.5000 Marker: 'none' MarkerSize: 6 MarkerFaceColor: 'none' XData: [0 0.0625 0.1250 0.1875 0.2500 0.3125 0.3750 0.4375 0.5000 0.5625 0.6250 0.6875 0.7500 0.8125 0.8750 0.9375 1 1.0625 1.1250 1.1875 1.2500 … ] (1×193 double) YData: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0095 0.0366 0.0787 0.1336 0.1991 0.2734 0.3544 0.4405 0.5301 0.6219 … ] (1×193 double) Use GET to show all properties
figure
plot(Line1.XData, Line1.YData, DisplayName="Simulation Response")
hold on
plot(Line3.XData, Line3.YData, DisplayName="Time-Magnitude Response")
hold off
legend(Location='best')
I commented-out most of the get calls. Uncomment them to see what they reveal.
.
EDIT -- (17 Dec 2025 at 14:38)
Clarified explanation.
.
  댓글 수: 1
Hannes
Hannes 대략 2시간 전
Thanks for the detailed response. When trying to run your example, I get the error "Undefined function 'Children' for input arguments of type 'resppack.simplot'".
Anyways, I seems to me that the method you suggest only extracts the datasets, consisting of time and y-Value, of each line of the plot, while losing information about the name of the corresponding output. This I could also accomplish with y = lsim(sys,u,t). Or do I miss anything?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Classical Control Design에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by