Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lsim, error message for single input system #767

Closed
wahlquisty opened this issue Nov 2, 2022 · 3 comments
Closed

lsim, error message for single input system #767

wahlquisty opened this issue Nov 2, 2022 · 3 comments

Comments

@wahlquisty
Copy link

If I want to simulate a system with one input, for example

using ControlSystemsBase
A = ones(3,3);
B = ones(3,1);
C = ones(1,3);
D = 0;
model = ss(A,B,C,D);

t = LinRange(0,10,100) |> Vector
u = [ones(10,1); zeros(90,1)];
modeld = c2d(model,t[2]-t[1]);

and I want to call lsim(modeld,u,t). However, this results in the error message u must be of size (nu, length(t)) and the input u needs to be transposed to be a row vector lsim(modeld,u',t).
I suggest either adding the special case of nu == 1 or improve the error message to clarify.

@mzaffalon
Copy link
Contributor

I have made a PR for the continuous case, #761 but it is worth updating it for the discrete one too.

@mzaffalon
Copy link
Contributor

This can be closed now. With v1.5.1 I get

julia> lsim(modeld,u,t)
ERROR: u must have size (1, 100): got size (100, 1)

@baggepinnen
Copy link
Member

awesome, thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants