Why is it giving me different observable canonical form?

In summary: The OP appears to have copied and pasted the code from the website into MATLAB, but changed the order of the variables.This is what's causing the discrepancy in the results.
  • #1
PainterGuy
940
69
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
  • #2
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!
 
  • #3
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 PainterGuy
  • #4
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.
 
  • #5
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.
 
  • #7
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 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 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 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
 
  • #14

1. Why do different systems have different observable canonical forms?

Different systems have different observable canonical forms because they have different underlying structures and dynamics. Observable canonical forms are used to represent the behavior of a system in a simplified and standardized way, but the specific form chosen may depend on the specific properties of the system being studied.

2. How do I determine the observable canonical form of a system?

The observable canonical form of a system can be determined by analyzing its state variables, inputs, and outputs. These variables are used to construct a state-space representation of the system, and from there, the observable canonical form can be derived using mathematical techniques such as diagonalization or Jordan canonical form.

3. Can two systems have the same observable canonical form?

Yes, two systems can have the same observable canonical form if they have similar underlying structures and dynamics. In some cases, different systems may exhibit the same observable behavior, and therefore, have the same observable canonical form.

4. Why is it important to use observable canonical form in system analysis?

Observable canonical form is important in system analysis because it allows for a simplified and standardized representation of a system's behavior. This makes it easier to compare and analyze different systems, and to identify key properties and behaviors that are shared among them.

5. Can observable canonical form change over time?

Yes, observable canonical form can change over time if the underlying dynamics of the system change. For example, if a system experiences a sudden change in input or a change in its internal structure, its observable canonical form may also change to reflect these changes in behavior.

Similar threads

Replies
1
Views
1K
  • Differential Equations
Replies
1
Views
1K
  • Introductory Physics Homework Help
Replies
1
Views
3K
  • Precalculus Mathematics Homework Help
Replies
6
Views
2K
  • Introductory Physics Homework Help
Replies
1
Views
2K
Replies
21
Views
3K
  • Advanced Physics Homework Help
Replies
6
Views
1K
Replies
16
Views
2K
  • Quantum Interpretations and Foundations
Replies
4
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
13
Views
2K
Back
Top