Can't solve integrate with unknown value and after an equation with it
3 次查看(过去 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 中查找有关 Special Values 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!