Mercurial > repos > public > sbplib
comparison subsSymfun.m @ 599:489bea7fc33f feature/grids
Add some functions to make symbolic life easier
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 26 Sep 2017 15:38:25 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
598:f6ada1719420 | 599:489bea7fc33f |
---|---|
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 |