Issue with InputVisibility for lsimplot

37 ビュー (過去 30 日間)
Hannes
Hannes 2025 年 12 月 17 日 13:34
回答済み: Andrew Ouellette 2025 年 12 月 23 日 23:41
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?

回答 (2 件)

Star Strider
Star Strider 2025 年 12 月 17 日 14:16
編集済み: Star Strider 2025 年 12 月 17 日 14:38
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 2025 年 12 月 17 日 14:35
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?

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


Andrew Ouellette
Andrew Ouellette 約4時間 前
The documented chart API for LSimPlot was introduced in R2024b. You will need to upgrade to that release or later to make use of the documented API.
t = 0:0.1:10;
u = sin(t);
lp = lsimplot(rss(3),u,t);
lp.InputVisible = false;
In releases before R2024b, the lsimplot function created a resppack.simplot object. As you've discovered, this object has several undocumented properties. The InputVisible property actually refers to the visibility of axes columns in the plot rather than the input line. To hide the input lines, you can set h.Input.Visible to 'off', where h is the resppack handle outputted by lsimplot.

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by