unexact calculations when using delayss

1 view (last 30 days)
David T_
David T_ on 5 Oct 2012
Hello community,
I'm using a state-space 2x3 MIMO model with inputDelays. When defining the model, however, I get some unwanted behaviour. Here is an example:
% set A
A=zeros(2);
% set B
B=[pi 2*pi 1;
0 1 0];
% set C
C=eye(2);
% set D
D=zeros(2,3);
% set delaystruct
delay=struct('delay',{3},'a', [],'b', -B,'c', [],'d', []);
% set G
G=delayss(A, B, C, D, delay);
G.b
When computing the inputmatrix with delays set to zero we get
4.4409e-016 8.8818e-016 0
-1.1102e-016 0 -4.1633e-017
although it should be zeros.
This bothers me even more when looking at output 2, which should definitely not depend on input 1 nor input 3. You see this effect quite well when looking at G in ltiview and activating 'normalize'
ltiview(G)
I hope you have some ideas how to solve this problem.
Greetz and thank you very much,
David
  2 Comments
Azzi Abdelmalek
Azzi Abdelmalek on 5 Oct 2012
what do you want to do with your mimo system
David T_
David T_ on 8 Oct 2012
Edited: David T_ on 8 Oct 2012
I will use it in simulations (Matlab/Simulink) as the process-model and later on want to include it in a MPC. I guess the unbounded error will fade in my MPC since I will use a state observer.

Sign in to comment.

Answers (1)

Matt Kindig
Matt Kindig on 5 Oct 2012
Edited: Matt Kindig on 5 Oct 2012
Hi David,
This is due to the fact that Matlab (like any computational program) stores numbers in a finite-precision length. In the case of Matlab doubles, it is a 64-bit binary number, according to the IEEE 754 floating-point specification. Since all values have a finite precision, numerical issues such as this are common (and in fact are expected). See, for example, http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F
Typically you would use some tolerance to detect a "zero" in your system. For example, if you have a matrix A,
A = [4.4409e-016 8.8818e-016 0;
-1.1102e-016 0 -4.1633e-017];
you can check whether is is within your tolerance as such
isZero = all(abs(A(:)) < 1e-15); %arbitrarily chosen tolerance
You'll see that isZero is true (1).
  1 Comment
David T_
David T_ on 8 Oct 2012
Edited: David T_ on 8 Oct 2012
Hi Matt,
thanks for the quick answer. I did consider problems due to finite precision. So I'll go with it, at least for the I/O pairs I did define a dependency.
In my opinion, however, this does not fully explain why delayss somewhat 'creates' unwanted dependencies. Furthermore, if you look at how output 2 reacts to a step-input on input 1, you see that it gets unbounded (due to the unstable pole of my model).
Since I want to use my MIMO in a quite lengthy Simulation, I want to make sure my errors keep small. In the above example the error does accumulate very slowly, I know, but the system I use has unstable poles (meaning Re(s_p)>0; contrary to the above integrator). So I fear that the errors will corrupt the model.
Furthermore I use delayss quite often. And if this is a usual case, then I will have to look into my subsystems for unwanted I/O pairings... which I rather not.
I guess I will have to separate my MIMO and not use delayss?! Or does anybody experience something similar when combining systems?
Greetings, David
PS: Thanks Matt for the link, btw. It led to some very interesting insights on how MATLAB treats roots. (Among other stuff.)

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!