我正在使用符号数学工具箱R2016b
中引入的新Matlab分段函数(https://www.mathworks.com/help/symbolic/piecewise.html)来定义函数,我正在尝试提取函数。具体来说,我的代码看起来像:
syms x;
y = piecewise(x>1,3*x^2,0);
我希望能够在没有条件的情况下从3*x^2
中提取y
。
知道怎么做吗?
答案 0 :(得分:0)
使用儿童:
syms x;
y = piecewise(x>1,3*x^2,0);
childs=children(y)
myfunc=childs(1)