title: how drop near zero terms Matlab symbolic
body: <p>I'm doing some symbolic matrix manipulations with complex value matrices.  Some of my results are as below.</p>
  <pre><code>Zaa*(1 + 3i/36028797018963968) + Zab*(1 + 3i/36028797018963968)
  </code></pre>
  <p>Is there a way to tell Matlab to ignore those near zero imaginary results so the answer is reported simply as,</p>
  <pre><code>Zaa + Zab
  </code></pre>
  <p><strong>UPDATE 1</strong>:  To provide the full background on how I am getting these results.  I am doing a calculation power electrical engineers call the similarity transformation.  It is used in symmetrical component analysis of power system faults and involves a complex transformation matrix and complex impedance values (the later are my symbolic variables Zaa, Zab etc.).</p>
  <p>Similarity transformation:
  <a href="https://i.stack.imgur.com/mUlCs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mUlCs.png" alt="enter image description here" /></a></p>
  <p>Where A is the 3x3 shown below and  <a href="https://i.stack.imgur.com/Svcqz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Svcqz.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/iTUHY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iTUHY.png" alt="enter image description here" /></a></p>
  <p>So, the full transformation calculation looks like this (the 1/3 scale factor comes from inverting A),</p>
  <p><a href="https://i.stack.imgur.com/AUjXm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AUjXm.png" alt="enter image description here" /></a></p>
  <p>Here is my Matlab code (requires Symbolic Toolbox)</p>
  <pre><code>syms Zaa Zab Zac Zba Zbb Zbc Zca Zcb Zcc
  Z = [Zaa Zab Zac; Zba Zbb Zbc; Zca Zcb Zcc]
  a = -1/2+sqrt(3)/2*1i
  A = [1 1 1; 1 a^2 a; 1 a a^2]
  Z012 = inv(A)*Z*A
  </code></pre>
  <p><strong>Final Update</strong>: After @holcher solved my problem I thought I'd post the finished code.</p>
  <pre><code>syms Zaa Zab Zac Zba Zbb Zbc Zca Zcb Zcc
  Z = [Zaa Zab Zac; Zba Zbb Zbc; Zca Zcb Zcc]
  a = -1/2+sqrt(sym(3))/2*1i
  A = [1 1 1; 1 a^2 a; 1 a a^2]
  Z012 = inv(A)*Z*A
  vpa(Z012,2)
  </code></pre>
  <p>p.s. The <a href="https://stackoverflow.com/questions/73558529/how-drop-near-zero-terms-in-octave-symbolic">parallel question</a> I had regarding solving this in Octave was also answered but required slightly different code. This final code runs in both Matlab &amp; Octave.</p>