How to calculate an integral with an implicit function ?
35 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hey ereryone,
I have a question for integral.
syms x y r1 r2 a01 a11 a21 a31 b01 b11 b21 b31 c01 c11 c21 c31 d01 d11 d21 d31 T_0K1 P_01;
T_0K = 273.15;
P_0 = 429.38;
a0 = 8.35752 * 1E1;
a1 = - 1243.7766;
a2 = 5434.089;
a3 = - 6713.2325;
b0 = - 4.6697 * 1E3;
b1 = 34516.3188;
b2 = -157195.483;
b3 = 193600.5854;
c0 = - 1.1607 * 1E1;
c1 = 215.3399;
c2 = - 931.1303;
c3 = 1147.6397;
d0 = 0.0172;
d1 = - 0.3339;
d2 = 1.3472;
d3 = - 1.6318;
A = a0 + a1 * ( 1 - y ) + a2 * ( 1 - y )^2 + a3 * ( 1 - y )^3;
B = b0 + b1 * ( 1 - y ) + b2 * ( 1 - y )^2 + b3 * ( 1 - y )^3;
C = c0 + c1 * ( 1 - y ) + c2 * ( 1 - y )^2 + c3 * ( 1 - y )^3;
D = d0 + d1 * ( 1 - y ) + d2 * ( 1 - y )^2 + d3 * ( 1 - y )^3;
x1 = log(0.13107);
x2 = log(0.2063);
x = log(exp(a01 + a11 * ( 1 - y ) + a21 * ( 1 - y )^2 + a31 * ( 1 - y )^3 + ...
(b01 + b11 * ( 1 - y ) + b21 * ( 1 - y )^2 + b31 * ( 1 - y )^3) / T_0K1 + ...
(c01 + c11 * ( 1 - y ) + c21 * ( 1 - y )^2 + c31 * ( 1 - y )^3) * log(T_0K1) + ...
(d01 + d11 * ( 1 - y ) + d21 * ( 1 - y )^2 + d31 * ( 1 - y )^3) * T_0K1)/P_01/y);
f = y / (y -1);
ff = int(f, x, r1, r2);
fff = eval(subs(ff, {r1 r2 a01 a11 a21 a31 b01 b11 b21 b31 c01 c11 c21 c31 d01 d11 d21 d31 T_0K1 P_01}, ...
{x1 x2 a0 a1 a2 a3 b0 b1 b2 b3 c0 c1 c2 c3 d0 d1 d2 d3 T_0K P_0}));
1 commentaire
Torsten
le 26 Août 2019
Modifié(e) : Torsten
le 26 Août 2019
Forget about using symbolic variables.
Use MATLAB's integral. To get the value of the function y(x)/(y(x)-1) for a given x, use "fzero" to find the (correct) root of the equation
x = log(exp(a01 + a11 * ( 1 - y ) + a21 * ( 1 - y )^2 + a31 * ( 1 - y )^3 + ...
(b01 + b11 * ( 1 - y ) + b21 * ( 1 - y )^2 + b31 * ( 1 - y )^3) / T_0K1 + ...
(c01 + c11 * ( 1 - y ) + c21 * ( 1 - y )^2 + c31 * ( 1 - y )^3) * log(T_0K1) + ...
(d01 + d11 * ( 1 - y ) + d21 * ( 1 - y )^2 + d31 * ( 1 - y )^3) * T_0K1)/P_01/y)
Réponses (1)
Chidvi Modala
le 30 Août 2019
I am assuming that you are trying to perform integration of the function f with respect to another function x.
int(expr,val) computes the indefinite integral of expr with respect to the symbolic scalar variable var. To perform integral with respect to another function, int() doesn’t seem to be a proper fit.
Mathematically it can be interpreted as follows
You may adopt the following methodology to implement the above integral
- Take the derivative of the function x with respect to y using ‘diff’ function
- Multiply the f function with the resultant derivative of x function
- Perform symbolic integration on the product with respect to y
You may use the following code snippet for your reference
f=diff(x); % derivative of function x wrt y
ff=f*(y/(y-1));
fff=int(ff,y,r1,r2); %integrating the product wrt to y
0 commentaires
Voir également
Catégories
En savoir plus sur Calculus dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!