Can't solve integrate with unknown value
8 次查看(过去 30 天)
显示 更早的评论
Im doing calculations in isothermal reactors and need to solve an integral with an unknown value (xa):
My code:
fun = @(xa) ( 1 / (k * CA0^2 * (1 - xa)^2 )
solve ( t == CA0 * integral(fun , 0 , xa ) , xa )
Where t is known, CA0 is known , k is known and xa is my unknown
If I solve by hand I get the right equation:
xa = k*CA0*t / (1 + k*CA0*t)
And can easy find my xa, it is not possible to find the right xa with my code.
Can you get: xa = k*CA0*t / (1 + k*CA0*t) from Matlab or an equation similar, which can find my xa?
Values:
CA0 = 2500, t = 13.57 and k = 1.40 * 10^-4
the xa should be 0.826
0 个评论
采纳的回答
Walter Roberson
2016-11-22
syms k CA0 xa t XA
fun = 1 / (k * CA0^2 * (1 - xa)^2 )
sol = solve(t == int(fun,xa,0,XA), XA, 'ReturnConditions',true)
Then
sol.XA
provided that sol.conditions is true
8 个评论
Karan Gill
2016-11-23
Frank, regarding "ReturnConditions", did you try looking up the documentation for solve at https://www.mathworks.com/help/symbolic/solve.html ?
更多回答(1 个)
Torsten
2016-11-22
Use "int" instead of "integral" for symbolic calculations.
Best wishes
Torsten.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!