Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: calculating a definite integral

Subject: calculating a definite integral

From: Aviral

Date: 15 Apr, 2008 14:48:02

Message: 1 of 5

I need to determine the value of a definite integral from
-pi to pi given by

X = [e^(jw)*I-A)^-1]*B*C*[e^(-jw)*I-A)^-1]dw

where A,B,C are matrices and I is an identity matrix. Can
anyone post a code to calculate this value please?

Thanks.

Subject: Re: calculating a definite integral

From: John D'Errico

Date: 15 Apr, 2008 15:03:02

Message: 2 of 5

"Aviral " <aviraltawakley@hotmail.com> wrote in message
<fu2f72$s9b$1@fred.mathworks.com>...
> I need to determine the value of a definite integral from
> -pi to pi given by
>
> X = [e^(jw)*I-A)^-1]*B*C*[e^(-jw)*I-A)^-1]dw
>
> where A,B,C are matrices and I is an identity matrix. Can
> anyone post a code to calculate this value please?


help quadv
 QUADV Vectorized QUAD.
    Q = QUADV(FUN,A,B) approximates the integral of the complex
    array-valued function FUN from A to B to within an error of 1.e-6 using
    recursive adaptive Simpson quadrature.


HTH,
John

Subject: Re: calculating a definite integral

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 15 Apr, 2008 17:35:47

Message: 3 of 5

In article <fu2f72$s9b$1@fred.mathworks.com>,
Aviral <aviraltawakley@hotmail.com> wrote:
>I need to determine the value of a definite integral from
>-pi to pi given by

>X = [e^(jw)*I-A)^-1]*B*C*[e^(-jw)*I-A)^-1]dw

>where A,B,C are matrices and I is an identity matrix. Can
>anyone post a code to calculate this value please?

There is no definite integral for that. There are an infinite
number of potential A matrices for which the you would be taking the
inverse of a singular matrix. Or B or C could be nilpotent.
With the information you give us, we can deduce that A is square,
that the second dimension of A is the same as the first dimension of B,
that the second dimension of C is the same as the first dimension of A,
and that the second dimension of B is the same as the first dimension of C,
but that common dimension between B and C could be anything --
we don't know if B and C are square, for example.
--
  "The whole history of civilization is strewn with creeds and
  institutions which were invaluable at first, and deadly
  afterwards." -- Walter Bagehot

Subject: Re: calculating a definite integral

From: Roger Stafford

Date: 18 Apr, 2008 19:17:01

Message: 4 of 5

"Aviral " <aviraltawakley@hotmail.com> wrote in message <fu2f72$s9b
$1@fred.mathworks.com>...
> I need to determine the value of a definite integral from
> -pi to pi given by
>
> X = [e^(jw)*I-A)^-1]*B*C*[e^(-jw)*I-A)^-1]dw
>
> where A,B,C are matrices and I is an identity matrix. Can
> anyone post a code to calculate this value please?
>
> Thanks.
-----------
  Aviral, if you substitute z = exp(j*w) in your definite integrals, they become
contour integrals taken with respect to z and moving counterclockwise
around the unit circle in the complex plane for the matrix-valued integrands

 -j*inv(z*I-A)*B*C*inv(1/z*I-A)/z.

Cramer's rule shows us that both these two inverses are rational functions of
z for each of the elements of the matrices. Thus each of the elements of the
above integrands is some rational and therefore meromorphic function of z.
We can find their integrals around the closed circle by simply evaluating all
their single poles which lie within the unit circle, by virtue of the theory of
residues.

  In principle, matlab's symbolic toolbox ought to be able to determine these
residues and therefore evaluate the integrals without resorting to numerical
quadrature. I am not sure how well the toolbox can actually perform at this
for large size matrices because the complexity of expressions increases
rapidly as their size increases, but you can try putting it through its paces
along these lines and see how well it performs.

Roger Stafford


Subject: Re: calculating a definite integral

From: Roger Stafford

Date: 19 Apr, 2008 00:28:02

Message: 5 of 5

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in
message <fuas3d$du7$1@fred.mathworks.com>...
> Aviral, if you substitute z = exp(j*w) in your definite integrals, they
become
> contour integrals taken with respect to z and moving counterclockwise
> around the unit circle in the complex plane for the matrix-valued
integrands
>
> -j*inv(z*I-A)*B*C*inv(1/z*I-A)/z.
>
> Cramer's rule shows us that both these two inverses are rational functions
of
> z for each of the elements of the matrices. Thus each of the elements of
the
> above integrands is some rational and therefore meromorphic function of
z.
> We can find their integrals around the closed circle by simply evaluating all
> their single poles which lie within the unit circle, by virtue of the theory of
> residues.
>
> In principle, matlab's symbolic toolbox ought to be able to determine
these
> residues and therefore evaluate the integrals without resorting to numerical
> quadrature. I am not sure how well the toolbox can actually perform at this
> for large size matrices because the complexity of expressions increases
> rapidly as their size increases, but you can try putting it through its paces
> along these lines and see how well it performs.
>
> Roger Stafford
------------
  It has occurred to me on thinking of the matter at greater length, that the
poles of the meromorphic function I referred to earlier are precisely the
eigenvalues of the matrix A and their reciprocals, a fact which should
considerably ease the burden of symbolic toolbox manipulation.

  Again referring to Cramer's rule, the inverse of z*I-A can be seen to be the
ratio of two polynomials in z. The denominator is just det(z*I-A), which in
turn equals (z-L1)*(z-L2)*...*(z-Ln) where L1, L2, ..., Ln are the eigenvalues of
A. The numerator will be some polynomial of no more than the n-1 degree.

  A similar situation exists for the inverse of 1/z*I-A in respect to the
reciprocals of A's eigenvalues. If the numerator and denominator from
Cramer's rule are multiplied by (-z)^n, and divided by the product of the
eigenvalues, then the denominator becomes (z-1/L1)*(z-1/L2)*...*(z-1/Ln)
and the numerator will become z times a polynomial of degree no more than
n-1. This first z factor will cancel out the z in the denominator of the original
integrand, namely at the right end of

 -j*inv(z*I-A)*B*C*inv(1/z*I-A)/z.

  Provided no eigenvalue lies right on the unit circle itself, (which would create
a singularity smack on the path of integration,) for each eigenvalue, either it
lies in the interior of the unit circle or its reciprocal does, but not both. This
gives us precisely n poles to be found in the interior of our meromorphic
integrand. The definite integral you seek is then equal to 2*pi*j times the
sum of the residues at these n poles.

  One way of determining these residues is this. Suppose eigenvalue L lies
inside the unit circle. If we take the symbolic derivative of the above
denominator, det(z*I-A), with respect to z, and then assign z in it to the
numerical value z = L, that is the equivalent of having divided det(z*I-A) by
z-L symbolically and then set z numerically equal to L in the remaining
factor. However, doing it this way avoids the problem of not possessing a
symbolic expression for L for sizes of A greater than 4x4. The entire
integrand, but corrected by having the z-L factor in the denominator
removed in this fashion, can then be evaluated numerically at z = L and the
result would be just the residue at this pole. An analogous method would be
used to adjust det(1/z*I-A) in a similar way for an eigenvalue occurring
outside the circle.

  This is admittedly something I haven't tried out on my computer as yet, but
the theory appears valid to me. The main practical difficulty I foresee is that
the toolbox may have trouble obtaining the above symbolic inverses for large
size matrices, A. Some of the expressions may not bear looking at by us
mere mortals for fear we will turn to stone, though we probably don't really
need to look at them to obtain numerical results from them. (On my system
no expression string is permitted to exceed 8192 characters, so I am
protected to a degree from excessive shock from such mind-boggling
visions. On the other hand, I can't get the symbolic inverse of z*I-A for
anything past a 3 x 3 matrix, A.)

  As to whether this method is superior to doing the integration by numerical
quadrature I cannot be sure. Numerical quadrature could encounter severe
accuracy problems if some of the eigenvalues happen to lie very near the unit
circle, as might be anticipated. Using the residue method would avoid such
problems for the most part, except that the residue obtained for the pole just
inside the circle, even though accurate, would presumably be very large. On
the other hand, it is probably much less laborious to prepare the code for
doing this problem numerically. In any case, you could regard this little
dissertation as strengthening your theoretical understanding of the nature of
the task facing you.

Roger Stafford


Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
residue theorem Roger Stafford 19 Apr, 2008 00:26:22
definite integral Aviral 15 Apr, 2008 10:50:19
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics