Problem using matlabFunction to convert symbolic expression
Show older comments
Using the following code...
syms c_c
cMax_c=23900;
x_c=c_c/cMax_c;
phi_c0=85.681*x_c^6-357.70*x_c^5+613.89*x_c^4-555.65*x_c^3+281.06*x_c^2-76.648*x_c-0.30987*exp(5.657*x_c^115.0)+13.1983;
cathodefunction1=matlabFunction(phi_c0)
...produces the issue that the resulting cathodefunction1 includes a c_c^115 which leads to NaN values at c_c>479:
cathodefunction1 = @(c_c)c_c.*(-3.207029288702929e-3)-exp(c_c.^115.*1.725152809214466e-503).*3.0987e-1+c_c.^2.*4.920432065264964e-7-c_c.^3.*4.070123767947935e-11+c_c.^4.*1.881477179770654e-15-c_c.^5.*4.587007343484818e-20+c_c.^6.*4.597239408413852e-25+1.31983e1
The initial equation doesn't lead to this issue since the value of c_c is devided by c_Max. Is there any way to work around this problem? Thanks!
Answers (0)
Categories
Find more on Symbolic Math Toolbox 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!