The code returns a value in the form of "theta_3b(x, z) =.". How can I get this to return just theta_3b=

조회 수: 3 (최근 30일)
syms f g x y z
% % % % % Temperature Formula 3b % % % % %
theta_3b=0;
for n=0:25
t=0;
beta6 = (n*pi)/H;
eta6 = (((2*pi)/L)*(n+0.5));
mew6 = -1036;
lamda6 = (beta6.^2)+(eta6.^2)+(mew6.^2);
f(x,y,z) = sin(beta6*z).*cos(eta6*x).*sin(mew6*y).*cos(mew6*y);
C_nmp_numerator6 = int(int(int(f,z,[0 H]),y,[0 W]),x,[0 (L/2)]);
g(x,y,z) = ((cos(mew6*y)^2).*sin(mew6*y) - ((h/(k*mew6)).*(sin(mew6*y)^2).*cos(mew6*y)));
C_nmp_denominator6 = ((L*H)/8)* (int(g,y,[0 W]));
C_nmp6 = C_nmp_numerator6/C_nmp_denominator6;
theta_3b = theta_3b+(C_nmp6*(sin(beta6*z)*cos(eta6*x)*((cos(mew6*y)-(h/(k*mew6))*sin(mew6*y)))*exp(-(lamda6^2)*alpha*t)));
end
theta_3b = vpa(subs(theta_3b, {x,y,z}, {X,Y,Z}))

답변 (2개)

Abhaya
Abhaya 2024년 9월 27일
Hi Clayton,
The variable theta_3b derives its type from variableC_nomp6, which is of type ‘symfun. This is why, when you display variable theta_3b, the associated symbols are shown alongside its name.
To display only the expression associated with the variable ‘theta_3b’ you can use MATLAB ‘findSymType’ function.
findSymType(theta_3b,'expression')
For more information, please follow the MATLAB documentation for findSymType’.
Hope it resolves your query.

Walter Roberson
Walter Roberson 2024년 9월 27일
theta_3b = vpa(subs(theta_3b, {x,y,z}, {X,Y,Z}));
fprintf('theta_3b = %s\n', char(theta_3b))

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by