Skip to content

Commit

Permalink
Merge pull request #895 from JuliaControl/ermsg
Browse files Browse the repository at this point in the history
better error message in lsim
  • Loading branch information
baggepinnen committed Oct 21, 2023
2 parents 154f41b + 8c8b49b commit 963bcab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ControlSystemsBase/src/timeresp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ function lsim(sys::AbstractStateSpace{<:Discrete}, u::AbstractVecOrMat; kwargs..
if size(u, 1) != nu
if u isa AbstractVector && sys.nu == 1
# The isa Array is a safeguard against type instability due to the copy(u')
@warn("u should be a row-vector of size (1, $nu): got size $(size(u)). The transpose of u will be used. To silence this warning, use the correct input dimension.")
@warn("u should be a row-vector of size (1, $(length(u))): got a regular vector of size $(size(u)). The transpose of u will be used. To silence this warning, use the correct input dimension.")
u = copy(transpose(u))
else
error("u must be a matrix of size (nu, length(t)) where nu=$nu, got size u = $(size(u))")
error("u must be a matrix of size (nu, length(t)) where the number of inputs nu=$nu, got size u = $(size(u))")
end
end
t = range(0, length=size(u, 2), step=sys.Ts)
Expand Down

0 comments on commit 963bcab

Please sign in to comment.