unexact calculations when using delayss
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Matt Kindig
2012-10-5
编辑:Matt Kindig
2012-10-5
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).
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Transmitters and Receivers 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!