Yuncong's Matlab tricks

From SeedWiki

Jump to: navigation, search
  • Claim symbols to be real
a = sym('a','real');
  • Substitute sub-expressions in symbolic calculations:
M = (x^2+y^2)^(1/2)*sin(alpha + atan2(y,x));
d = (x^2+y^2)^(1/2);
theta = alpha + atan2(y,x);
q = simplify(feval(symengine,'subsex',M,[char(d) '=d,' char(theta) '=theta']));
  • atan2 for symbolic calculations:

http://en.wikipedia.org/wiki/Atan2#Definition

  • Read data from formatted text

http://www.mathworks.com/matlabcentral/fileexchange/10946-readtext

  • Linux launcher

matlab -desktop &

  • Remove empty elements in a cell
result = c(~cellfun('isempty',c))
Personal tools
projects