Skip to content

Commit 8c43b52

Browse files
authored
Merge pull request #1691 from SciML/baggepinnen-patch-1
Fix dimension mismatch and wrong equation in linearize
2 parents 0ceecb6 + 53dac11 commit 8c43b52

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/systems/abstractsystem.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,11 +1210,11 @@ function linearize(sys, lin_fun; t = 0.0, op = Dict(), allow_input_derivatives =
12101210
C = [
12111211
h_x h_z
12121212
]
1213-
Bs = -(gz \ (f_x * f_u + g_u))
1213+
Bs = -(gz \ g_u) # This equation differ from the cited paper, the paper is likely wrong since their equaiton leads to a dimension mismatch.
12141214
if !iszero(Bs)
12151215
if !allow_input_derivatives
12161216
der_inds = findall(vec(any(!=(0), Bs, dims = 1)))
1217-
error("Input derivatives appeared in expressions (-g_z\\(f_x*f_u + g_u) != 0), the following inputs appeared differentiated: $(inputs(sys)[der_inds]). Call `linear_staespace` with keyword argument `allow_input_derivatives = true` to allow this and have the returned `B` matrix be of double width ($(2nu)), where the last $nu inputs are the derivatives of the first $nu inputs.")
1217+
error("Input derivatives appeared in expressions (-g_z\\g_u != 0), the following inputs appeared differentiated: $(inputs(sys)[der_inds]). Call `linear_staespace` with keyword argument `allow_input_derivatives = true` to allow this and have the returned `B` matrix be of double width ($(2nu)), where the last $nu inputs are the derivatives of the first $nu inputs.")
12181218
end
12191219
B = [B Bs]
12201220
end

0 commit comments

Comments
 (0)