Mercurial > repos > public > sbplib
comparison subsSymfun.m @ 696:7c16b5af8d98 feature/quantumTriangles
Add Jonatans symbolic lifehax
author | Ylva Rydin <ylva.rydin@telia.com> |
---|---|
date | Thu, 05 Oct 2017 18:04:23 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
695:ba0d31ce4121 | 696:7c16b5af8d98 |
---|---|
1 % Subs for a symfun | |
2 % f remains a symbolic function. If any of it's arguments is eliminated | |
3 % it is removed from the argument list while preserving the order of the | |
4 % other arguments | |
5 function f = subsSymfun(f, old, new) | |
6 args = argnames(f); | |
7 | |
8 newExpr = subs(f, old, new); | |
9 vars = symvar(subs(args, old, new)); | |
10 | |
11 newArgs = args(ismember(args,vars)); | |
12 | |
13 f = symfun(newExpr, newArgs); | |
14 end |