Skip to content

Defining source term and constraint throws "cannot reshape array of size 12 into shape (1,10)" #300

Answered by akaptano
ZorrRRo asked this question in Q&A
Discussion options

You must be logged in to vote

I believe your constraint is not what you intend. It is prescribing that the coefficient of the constant term in the x0' equation should be equal to 1, which is why you get x0' ~ 1 + ..., which is not the duffing oscillator. Try constraint_lhs[0, 2] = 1 to make x0' = 1 * x1 + ... and you can additionally add constraints to zero out all the other terms (since x0' = x1 exactly here actually).

I think the control u should be compatible with ConstrainedSR3 since u is just appended to the existing state variables so x = [x0, x1, u] and the constraints should work (albeit may need to be adjusted in the indices). What is the variable f above that you use during model.simulate?

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@ZorrRRo
Comment options

Answer selected by ZorrRRo
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ZorrRRo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants