필터 지우기
필터 지우기

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

조회 수: 2 (최근 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?

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by