Unable to find value of T1

3 ビュー (過去 30 日間)
MINATI PATRA
MINATI PATRA 2019 年 9 月 29 日
コメント済み: Walter Roberson 2019 年 10 月 10 日
syms L m x xx s theta_b h Z y U T0 T1 T2 k0 b Tinf Tb sumsol
k=6;
sym('u0(x)');('u1(x)');('u2(x)');('u3(x)');('u4(x)');('u5(x)');('u6(x)');('u7(x)');('u8(x)');('u9(x)');('u10(x)');
('u11(x)');('u12(x)');('u13(x)');('u14(x)');('u15(x)');('u16(x)');('u17(x)');('u18(x)');('u19(x)');('u20(x)');
s='u0(x)'+h*'u1(x)'+h^2*'u2(x)'+h^3*'u3(x)'+h^4*'u4(x)'+h^5*'u5(x)'+h^6*'u6(x)'+h^7*'u7(x)'+h^8*'u8(x)'+h^9*'u9(x)'...
+h^10*'u10(x)'+h^11*'u11(x)'+h^12*'u12(x)'+h^13*'u13(x)'+h^14*'u14(x)'+h^15*'u15(x)'+h^16*'u16(x)'+h^17*'u17(x)'...
+h^18*'u18(x)'+h^19*'u19(x)'+h^20*'u20(x)';
Ak=(1/factorial(k))*subs(diff(1/s*(diff(s,x))^2,h,k),h,0);Bk=(1/factorial(k))*subs(diff(s^(1-Z),h,k),h,0);Ck=(1/factorial(k))*subs(diff(s^(-Z),h,k),h,0);
Linverse = int(1/xx*int(y*x,x,0,xx),xx,L,x);
L=0.05;Tinf=273+25;Tb=273+150;h=4;beta=-1.3;Z=-1.3;k0=148*300^-beta;b=0.005;
T1=-beta*Linverse(subs(Ak(0),sym('u0(x)'),T0))+2*h*L/k0/b*Linverse(subs(Bk(0)/x,sym('u0(x)'),T0)) -2*h*L*Tinf/k0/b*Linverse(subs(Ck(0)/x,sym('u0(x)'),T0))
  5 件のコメント
MINATI PATRA
MINATI PATRA 2019 年 9 月 30 日
Dear Walter
This code worked previously in a research paper.
Walter Roberson
Walter Roberson 2019 年 9 月 30 日
I guarantee that the code you posted never worked.
Ak=(1/factorial(k))*subs(diff(1/s*(diff(s,x))^2,h,k),h,0);Bk=(1/factorial(k))*subs(diff(s^(1-Z),h,k),h,0);Ck=(1/factorial(k))*subs(diff(s^(-Z),h,k),h,0);
That is a symbolic expression.
Ak(0)
That attempts to index the symbolic expression at location 0. 0 is not a valid subscript for symbolic expressions.
Ak(0) and Bk(0) and Ck(0) only make sense if Ak, Bk, and Ck are either functions or symbolic functions. Converting them to symbolic functions of one variable is not difficult, but which variable?
Likewise, Linverse(symbolic expression) only makes sense if Linverse is a function or symbolic function. You can convert to symbolic function, but function of what variable?
sym('u0(x)');('u1(x)');('u2(x)');('u3(x)');('u4(x)');('u5(x)');('u6(x)');('u7(x)');('u8(x)');('u9(x)');('u10(x)');
That creates the symbolic expression u0(x) in sufficiently old versions of MATLAB (in more recent versions it is an error.) It then throws away that symbolic expression. Then it creates the character vector 'u1(x)' and throws away the character vector. The sym() call does not enclose the 'u1(x)'
syms u0(x) u1(x) u2(x) u3(x) u4(x) u5(x) u6(x) u7(x) u8(x) u9(x) u10(x) u11(x) u12(x) u13(x) u14(x) u15(x) u16(x) u17(x) u18(x) u19(x) u20(x)
would be meaningful MATLAB.
s='u0(x)'+h*'u1(x)'+h^2*'u2(x)'+h^3*'u3(x)'+h^4*'u4(x)'+h^5*'u5(x)'+h^6*'u6(x)'+h^7*'u7(x)'+h^8*'u8(x)'+h^9*'u9(x)'...
That works more accidentally in older versions. 'u0(x)' is functioning as a character vector there, not as a symbolic expression. If you had 'u0(x)' + 'h*u1(x)' then that would fail due to trying to add character vectors of different lengths.
s = u0(x)+h*u1(x)+h^2*u2(x)+h^3*u3(x)+h^4*u4(x)+h^5*u5(x)+h^6*u6(x)+h^7*u7(x)+h^8*u8(x)+h^9*u9(x)...

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

回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 9 月 30 日
The below can at least execute without error. It is not clear that it is using the proper variable as the parameters for Ak, Bk, Ck.
syms L m x xx s theta_b h Z y U T0 T1 T2 k0 b Tinf Tb sumsol
k=6;
syms u0(x) u1(x) u2(x) u3(x) u4(x) u5(x) u6(x) u7(x) u8(x) u9(x) u10(x) u11(x) u12(x) u13(x) u14(x) u15(x) u16(x) u17(x) u18(x) u19(x) u20(x)
s = u0(x)+h*u1(x)+h^2*u2(x)+h^3*u3(x)+h^4*u4(x)+h^5*u5(x)+h^6*u6(x)+h^7*u7(x)+h^8*u8(x)+h^9*u9(x)...
+h^10*u10(x)+h^11*u11(x)+h^12*u12(x)+h^13*u13(x)+h^14*u14(x)+h^15*u15(x)+h^16*u16(x)+h^17*u17(x)...
+h^18*u18(x)+h^19*u19(x)+h^20*u20(x);
Ak(x)=(1/factorial(k))*subs(diff(1/s*(diff(s,x))^2,h,k),h,0);
Bk(x)=(1/factorial(k))*subs(diff(s^(1-Z),h,k),h,0);
Ck(x)=(1/factorial(k))*subs(diff(s^(-Z),h,k),h,0);
Linverse(x) = int(1/xx*int(y*x,x,0,xx),xx,L,x);
L=0.05;
Tinf=273+25;
Tb=273+150;
h=4;
beta=-1.3;
Z=-1.3;
k0=148*300^-beta;
b=0.005;
T1_raw = -beta*Linverse(subs(Ak(0),u0(x),T0))+2*h*L/k0/b*Linverse(subs(Bk(0)/x,u0(x),T0)) -2*h*L*Tinf/k0/b*Linverse(subs(Ck(0)/x,u0(x),T0));
T1 = simplify(subs(T1_raw));
disp(T1)
  2 件のコメント
MINATI
MINATI 2019 年 10 月 10 日
Sorry Walter
Actually my laptop was out of order, so came late in the forum. But the "accepted answer" option is not in this page. HoW to accept?
Walter Roberson
Walter Roberson 2019 年 10 月 10 日
It appears you used a different login name before, so it does not know you are the same person who asked the Question. I cannot Accept it myself, as I cannot Accept my own answers .

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

カテゴリ

Help Center および File ExchangeNumber Theory についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by