question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Output matrix wrong dimensions

See original GitHub issue

Hi,

I am experimenting with the vehicle steering jupyter example. I noticed the following:

In subsection “Linearization of lateral steering dynamics (Example 6.13)”: # Compute the linearization at velocity 10 m/sec lateral_linearized = ct.linearize(lateral, [0, 0], [0], params=vehicle_params)

When I checked the output matrix of the linearized system, i.e, lateral_linearized.C, it is a 2x2 matrix. This is contradicting with the book & and the explanation on this page. It should rather be a 1x2 matrix with C = np.array([[1, 0]]). I am wondering the source of this inconsistency.

Additionally, a minor fix: The comment should be modified to 15/msec, since this is the given parameter of the vehicle in the code.

Thanks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bnavigatorcommented, May 13, 2020

Okay, I see it now. Remove the ‘theta’ from outputs, which does not make sense, because vehicle_output()[1:] only returns ‘y’.

lateral = ct.NonlinearIOSystem(
    lambda t, x, u, params: vehicle_update(
        t, [0., x[0], x[1]], [params.get('velocity', 1), u[0]], params)[1:],
    lambda t, x, u, params: vehicle_output(
        t, [0., x[0], x[1]], [params.get('velocity', 1), u[0]], params)[1:],
    states=2, name='lateral', inputs=('phi'), outputs=('y')
)

This also obsoletes the 0 row index later in the block:

# Set the output to be the normalized state x1/b
lateral_normalized = lateral_transformed * (1/b)
0reactions
bnavigatorcommented, May 14, 2020

I would say leave it open until this will by fixed by changes in the notebook and control.iosys. I might contribute a PR later.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Numpy shape method returns wrong dimensions
The problem is b.shape returns (3,) instead of (3,3) . It is important because I need to do a matrix multiplication ...
Read more >
R Error: incorrect number of dimensions (2 Examples)
This tutorial explains how to avoid the error “incorrect number of dimensions” in the R programming language. The table of content is structured...
Read more >
Wrong with matrix dimensions - MATLAB Answers - MathWorks
I assume the error is at the bolded line ( e = PH./p ). It looks like this is due to a row...
Read more >
Dot product result has wrong dimension [closed]
Here's a fix. Although I agree with @MichaelE2 that inverting a symbolic matrix is asking for trouble! First, in your W matrix, ...
Read more >
Matrix multiplication dimensions (article) | Khan Academy
A matrix is a rectangular arrangement of numbers into rows and columns. Each number in a matrix is referred to as a matrix...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found