Can't solve integrate with unknown value and after an equation with it

3 ビュー (過去 30 日間)
Pietro N
Pietro N 2021 年 11 月 7 日
編集済み: Pietro N 2021 年 11 月 7 日
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

回答 (1 件)

John D'Errico
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)
cag = 
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)
ans = 
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.
  1 件のコメント
Pietro N
Pietro N 2021 年 11 月 7 日
編集済み: Pietro N 2021 年 11 月 7 日
Sprry i did a mistake, the correct script for int is the following one:
int(fun,ca,ca0,CA)
I would like matlab to "write" the integral expression of the fun -1 / (1.4*ca^(1.4)):
where ca0=9.8.
Then, i want to solve the equation: (I also corrected the script of equation)
0 == int(fun,ca,ca0,CA)- (cag-CA)/(-1.4*cag^1.4)
and find a solution.
I run the code
clear all, clc
syms x CA ca
ca0=9.8;
%cA goal
cag = solve((ca0-x)/ca0 - 0.8== 0, x);
disp('Goal Conc of A : ');
disp(cag);
fun = -1 / (1.4*ca^(1.4));
sol = solve(0 == (cag-CA)/(-1.4*cag^1.4) -int(fun,ca,ca0,CA) , CA, 'ReturnConditions',true);
sol.CA
And this time the solution is:
Goal Conc of A :
49/25
ans =
z2^5
What does " z2^5 " mean? Can't i get a real number solution?

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by