Why is it giving me different observable canonical form?

Click For Summary

Discussion Overview

The discussion revolves around discrepancies in the observable canonical form of a control system as computed by MATLAB's canon function compared to manual calculations. Participants explore the implications of different polynomial orders in the numerator and denominator, the observability of the system, and the potential differences in definitions of canonical forms in MATLAB versus standard textbooks.

Discussion Character

  • Debate/contested
  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • One participant expresses confusion over the observable canonical form calculated by MATLAB, noting it yields different values for B, C, and D compared to their own calculations.
  • Another participant questions the order of the numerator and denominator polynomials, suggesting this may be a source of error and emphasizes the importance of checking the observability of the system.
  • Some participants point out that the MATLAB documentation may not align with traditional definitions of observable canonical form, suggesting that MATLAB's implementation may differ from standard textbook approaches.
  • There is a discussion about the coefficients of the polynomial, with one participant noting inconsistencies in the values assigned to b_0 and suggesting that the highest order term should match between the numerator and denominator.
  • Several participants highlight the potential for MATLAB's canon function to produce valid alternative canonical forms that may not correspond directly to definitions found in textbooks.
  • One participant mentions that MATLAB's documentation states that the companion form is similar to the observable canonical form, which raises questions about the accuracy of the output.
  • Another participant suggests that MATLAB's internal calculations may differ from those presented in literature, indicating a need for clarification in the documentation.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the correctness of the observable canonical form produced by MATLAB versus manual calculations. Multiple competing views regarding the definitions and implementations of canonical forms remain unresolved.

Contextual Notes

Participants note that the MATLAB canon function may produce results that are valid but not necessarily aligned with traditional definitions found in textbooks. There is also mention of potential issues with the observability of the system and the significance of polynomial order in the calculations.

PainterGuy
Messages
938
Reaction score
73
Hi,
1614839768937.png


I found the above observable canonical form using this source:
https://www.mathworks.com/help/cont....html#mw_a76b9bac-e8fd-4d0e-8c86-e31e657471cc

I'm almost certain that I did do it correctly. But the code below gives me different values for B, C, and D. Could you please help me to understand what's going on? Which form is correct?

Matlab:
close all; clear all; clc;

num=[3 1.5 4 5];
den=[1 7 8 10 11];

G = tf([num], [den]) % conversion into transfer function in s

obs_canon = canon(G,'companion') % observable canonical form
Output:
1614841035370.png
 
Engineering news on Phys.org
PainterGuy said:
Hi,
View attachment 279119

I found the above observable canonical form using this source:
https://www.mathworks.com/help/cont....html#mw_a76b9bac-e8fd-4d0e-8c86-e31e657471cc

I'm almost certain that I did do it correctly. But the code below gives me different values for B, C, and D. Could you please help me to understand what's going on? Which form is correct?

Matlab:
close all; clear all; clc;

num=[3 1.5 4 5];
den=[1 7 8 10 11];

G = tf([num], [den]) % conversion into transfer function in s

obs_canon = canon(G,'companion') % observable canonical form
Output:
View attachment 279120

Help, please!
 
I'm very rusty on this and was looking through my book. Something is throwing me off with your polynomial and I am thinking this is where things might be getting messy for you. The numerator and denominator are two different orders. Are you also sure that your system is observable? Convert it to a state space system then get the observability matrix
$$P_O = \begin{bmatrix} C \\
CA \\
\vdots \\
CA^{n-1} \end{bmatrix}$$

Make sure the determinant of that matrix isn't zero. For reference: I got this from Modern Control Systems by Dorf.
 
  • Like
Likes   Reactions: PainterGuy
Thank you!

Joshy said:
Something is throwing me off with your polynomial and I am thinking this is where things might be getting messy for you.

I used the following source by mathworks (maker of Matlab) to calculate the observable canonical form by hand therefore I'd say that MATLAB should be using the same method internally to calculate the form:
https://www.mathworks.com/help/cont....html#mw_a76b9bac-e8fd-4d0e-8c86-e31e657471cc

But the forms calculated by me and MATLAB are different as I pointed out earlier.
 
But for ##b_0## you called it ##3##. Shouldn't ##b_0## be the coefficient to your highest order term ##s^4## just like the denominator?

This still won't align with the answer it gave you, but just some inconsistency I'm seeing somewhere.
 
I think someone should move this to homework help. That might get more attention.

I might be looking at something that doesn't matter, but just pointing it out... do both the top and bottom have a ##s^4## term? Highest order on the denominator is ##s^4##, and in your source they don't use ##s^n## and ##s^m##, and so I would think ##n## on the top and bottom should equal the same. On your numerator there is no ##s^4## term and so I would think if I were trying to copy that, then ##b_0## would be zero and ##b_1## would be ##3##.

I'm not sure if it matters because this would still make

$$B = \begin{bmatrix} 5 \\
4 \\
1.5 \\
3 \end{bmatrix}$$

There's also a note in your source that says this:
The transformation of the system to companion form is based on the controllability matrix which is almost always numerically singular for mid-range orders. Hence, avoid using it for computation when possible.

I'm trying to understand what this means and that's why I'm looking at the order of your system.
 
  • Like
Likes   Reactions: PainterGuy
  • #10
PainterGuy said:
Sorry but it does give Observable Canonical Form.

Your code does not.
 
  • #11
That's what they're asking about- the purpose of the thread. They appear to have followed the instructions on the website and it gave them something different. It says right under Observable Canonical Form

You can obtain the observable canonical form of your system by using the https://www.mathworks.com/help/control/ref/canon.html command in the following way:

Code:
csys = canon(sys,'companion')

What did the OP do wrong if anything? I'm trying to understand too.
 
  • Like
Likes   Reactions: PainterGuy
  • #12
Maybe it's an error in the Matlab documentation?

http://www.engr.mun.ca/~millan/Eng6825/index.html
http://www.engr.mun.ca/~millan/Eng6825/canonicals.pdf
He does the same example in the usual form in section 1.1 and the Matlab form in section 1.5.

"Caution should be taken when using the MATLAB canon() command, which is a method for converting amongst the canonical forms. MATLAB produces valid alternative canonical forms, but they are not the sameas the definitions used in our textbook. In MATLAB the companion form is similar to the observable canonical form, and the modal form is similar to the diagonal form. They will all produce exactly the same input to output dynamics, but the model structures and states are different."
 
Last edited:
  • Like
Likes   Reactions: PainterGuy
  • #13
I'd say MATLAB internally uses some quite different formula(s) to calculate canonical forms though the documentation given by Mathworks (creator of MATLAB) says something different which is along the lines of approach used by standard textbooks such as Ogata's Modern Control Engineering, 5th, as shown below. You can see both Mathworks source and Ogata are following the same approach to find observable canonical form.

1615259573047.png

Source: Modern Control Engineering, Ogata, 5th ed
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 6 ·
Replies
6
Views
3K
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
21
Views
4K
  • · Replies 15 ·
Replies
15
Views
5K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K