I am struggling with setting my own labels correctly in a plot of a step response of a MIMO system.
Consider a generic MIMO LTI system with 2 inputs and 2 outputs, say:
using ControlSystems
using Plots
A = [-10 2; 3 -40]
B = [5 6; 7 8]
C = [9 10; 11 12]
G = ss(A, B, C, 0)
We compute the step response using the step function. When plotting it, I want to set my own ylabel
s and my own label
s. I do it by substituting a row matrix of strings.
step_response = step(G, 10.0)
plot(step_response, title="", xlabel="Time (s)", ylabel=["y₁" "y₂"], lw=2, label=["From u₁" "From u₂"], legend=:topright)
While this works for the ylabel
, it does not for the label
. What I get is
Setting label=["From u₁", "From u₂"]
does not help.
I can do it by using a named system as in
using RobustAndOptimalControl
G = named_ss(G, u = [:u₁, :u₂], y = [:y₁, :y₂])
step_response = step(G, 10.0)
plot(step_response, title="", xlabel="Time (s)", lw=2)
But still, is it possible to do it without the named system, just by manually overwriting the labels in the plot?