Can't solve integrate with unknown value and after an equation with it
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi,
I would solve the following equation:
clear all, clc
syms x
ca0=9.8;
%cA goal
cag=vpasolve((ca0-x)/ca0 - 0.8== 0, x);
disp('Goal Conc of A : ');
disp(cag);
syms ca CA cag
fun = -1 / (1.4*ca^(1.4));
sol = solve(0 == int(fun,ca,0,CA)- (cag-CA)/(-1.4*CA^1.4) , CA, 'ReturnConditions',true);
sol.CA
I don't know if the code is right, i tried to copy and adapt some code found in this forum.
I explain what i would do. I want to do the integration of the fun between 0 and the unknown variable CA; and after that, i want to solve the equation of previous integration and an other expression (cag-CA)/(-1.4*CA^1.4) tha has the same unknown variable CA, all equal to zero. The problem is that i don't get a solution for CA. The matlab result in command windows is:
Warning: Unable to find explicit solution. For options, see help.
> In sym/solve (line 317)
In dom2v2 (line 10)
ans =
Empty sym: 0-by-1
댓글 수: 0
답변 (1개)
John D'Errico
2021년 11월 7일
편집: John D'Errico
2021년 11월 7일
First, you don't need to use vpasolve. Solve will do. Leave it in a fractional form, rather than converting to a finite number of decimal digits, as vpasolve will do.
syms x CA ca
ca0=9.8;
%cA goal
cag = solve((ca0-x)/ca0 - 0.8== 0, x)
Next, when you then did this, AFTER you had already computed cag?
syms ca CA cag
that overwrote the value of cag. It is already defined. Do not do that. Next, look at that integral. Does it exist?
fun = -1 / (1.4*ca^(1.4));
int(fun,ca,0,CA)
Nope. It is not finite.
Your problem is not that solve has gotten hung up. It is that the integral you tried to compute does not have a finite value.
I don't know what you think you are trying to compute here. But you need to think again.
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!