필터 지우기
필터 지우기

Can't solve integrate with unknown value

조회 수: 2 (최근 30일)
Frank Hansper
Frank Hansper 2016년 11월 21일
댓글: Frank Hansper 2016년 11월 24일
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

채택된 답변

Walter Roberson
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
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 ?
Frank Hansper
Frank Hansper 2016년 11월 24일
Yes and I must say, I had a brain fart - I thought Matlab would return the solution with ''it's'' conditions of the solution. ex. Matlab returns what it uses symbolic and what is uses numeric. So I found it unnecessary at first.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Torsten
Torsten 2016년 11월 22일
Use "int" instead of "integral" for symbolic calculations.
Best wishes
Torsten.

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by