Math & ScienceAlignment for Condition inside Matrix

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
ankitravankar
Posts: 10
Joined: Mon Jun 18, 2012 10:06 am

Alignment for Condition inside Matrix

Post by ankitravankar »

Can someone please help me writing this equation? Especially the condition part with Z_{0:k}. I am not getting how to write the condition in between the lines and still keep the size of the matrix same both sides.
Attachments
The desired Equation.
The desired Equation.
equation.jpg (18.69 KiB) Viewed 4119 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10359
Joined: Mon Mar 10, 2008 9:44 pm

Re: Alignment for Condition inside Matrix

Post by Stefan Kottwitz »

Please post what you already have, of this equation. So readers would not have to type all from scratch, including what you already have and what's no problem for you.

Stefan
LaTeX.org admin
ankitravankar
Posts: 10
Joined: Mon Jun 18, 2012 10:06 am

Alignment for Condition inside Matrix

Post by ankitravankar »

This is what I've tried so far.

Code: Select all

\begin{align}
  \mathbf{P}_{k \mid k} &=
  \mathbf{\begin{bmatrix}
    \mathbf{P}_{xx} & \mathbf{P}_{xm} \\ 
    \mathbf{P}^T_{xm} & \mathbf{P}_{mm}  
  \end{bmatrix}}_{k \mid k} \\
  &= \mathbf{E}
  \begin{bmatrix}
    \begin{pmatrix}
      \mathbf{x}_k-\hat{\mathbf{x}_k} \\
      \mathbf{m}-\hat{\mathbf{m}_k} 
    \end{pmatrix}
    & \begin{pmatrix}
        \mathbf{x}_k-\hat{\mathbf{x}_k} \\
        \mathbf{m}-\hat{\mathbf{m}_k} 
      \end{pmatrix}^T
    & \mid\mathbf{Z}_{0:k}
  \end{bmatrix} \nonumber
\end{align}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10359
Joined: Mon Mar 10, 2008 9:44 pm

Alignment for Condition inside Matrix

Post by Stefan Kottwitz »

You could use \left[ and \right] instead of the outer bmatrix in the second line:

Code: Select all

\begin{align}
\mathbf{P}_{k \mid k} &= \mathbf{\begin{bmatrix}
\mathbf{P}_{xx} & \mathbf{P}_{xm} \\
\mathbf{P}^T_{xm} & \mathbf{P}_{mm}  
\end{bmatrix}}_{k \mid k} \\
                      &= \mathbf{E}\left[
\begin{pmatrix}
\mathbf{x}_k-\hat{\mathbf{x}_k} \\
\mathbf{m}-\hat{\mathbf{m}_k}
\end{pmatrix} \begin{pmatrix}
\mathbf{x}_k-\hat{\mathbf{x}_k} \\
\mathbf{m}-\hat{\mathbf{m}_k}
\end{pmatrix}^T \mid\mathbf{Z}_{0:k}
\right] \nonumber
\end{align}
And I would write the math accents differently, i.e. \hat{\mathbf{m}}_k instead of \hat{\mathbf{m}_k}, look at the position of the accent.

Stefan
LaTeX.org admin
ankitravankar
Posts: 10
Joined: Mon Jun 18, 2012 10:06 am

Re: Alignment for Condition inside Matrix

Post by ankitravankar »

thanks stefan it was a simple mistake.. thanks for pointing it out..

cheers
Post Reply