subs function handle not working with arrayfun
Show older comments
subbed_cell_out = arrayfun(@subs,sym_fun_cell,'uniformoutput',false); % No change to sym_fun_cell
I have a cell array of matrices containing symbolic functions (ie. sym_fun_cell).
The symbolic functions themselves are functions of 'x' and 'x_r'. So I want to sub for x_r and x which already have values assigned within the workspace.
An example of an element of sym_fun_cell is:
[ 0.05*(13.0*x^3 - 10.0*x^2 + 1.0)^2, 0.05*(3.4*x^3 - 3.7*x^2 + x)*(13.0*x^3 - 10.0*x^2 + 1.0), 0.05*(- 13.0*x^3 + 10.0*x^2)*(13.0*x^3 - 10.0*x^2 + 1.0), -0.05*(- 3.4*x^3 + 1.9*x^2)*(13.0*x^3 - 10.0*x^2 + 1.0)]
[ 0.05*(3.4*x^3 - 3.7*x^2 + x)*(13.0*x^3 - 10.0*x^2 + 1.0), 0.05*(3.4*x^3 - 3.7*x^2 + x)^2, 0.05*(- 13.0*x^3 + 10.0*x^2)*(3.4*x^3 - 3.7*x^2 + x), -0.05*(- 3.4*x^3 + 1.9*x^2)*(3.4*x^3 - 3.7*x^2 + x)]
[ 0.05*(- 13.0*x^3 + 10.0*x^2)*(13.0*x^3 - 10.0*x^2 + 1.0), 0.05*(- 13.0*x^3 + 10.0*x^2)*(3.4*x^3 - 3.7*x^2 + x), 0.05*(- 13.0*x^3 + 10.0*x^2)^2, -0.05*(- 13.0*x^3 + 10.0*x^2)*(- 3.4*x^3 + 1.9*x^2)]
[ -0.05*(- 3.4*x^3 + 1.9*x^2)*(13.0*x^3 - 10.0*x^2 + 1.0), -0.05*(- 3.4*x^3 + 1.9*x^2)*(3.4*x^3 - 3.7*x^2 + x), -0.05*(- 13.0*x^3 + 10.0*x^2)*(- 3.4*x^3 + 1.9*x^2), 0.05*(- 3.4*x^3 + 1.9*x^2)^2]
Thanks
1 Comment
Walter Roberson
on 1 Mar 2017
That code seems to be appropriate to me. I works when I test with it.
Answers (0)
Categories
Find more on Number Theory in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!