The variables always appear as (1x400 sym) in workspace
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I have a problem with the values of cv2 that are not substituted with the values of (xd), hence no substitution in cv3. It says cv2 = 1x400 sym in workspace, I don't know where i made a mistake. Please help me, i would appriciate it.
clc
clear all
syms x T xd
T = linspace(12,1000,400);
kb = 1.38*10^-23;
xd = T/2240;
h = 6.64*10^-34;
v = 18000;
p = 6.*kb.^4*T.^3./(pi.^2*h.^3*v.^3);
%y = x^4*exp(x)/(exp(x)-1)^2;
%cv = p.*24.*(x.^3.*log(exp(x)-1)./6 + polylog(4,exp(x)) - x.*polylog(3,exp(x)) + x.^2.*polylog(2,exp(x))/2) - p.*x.^4./(exp(x)-1) - p.*x.^4;
cv2 = p.*24.*(xd.^3.*log(exp(xd)-1)./6 + polylog(4,exp(xd)) - x.*polylog(3,exp(xd)) + x.^2.*polylog(2,exp(xd))/2) - p.*x.^4./(exp(xd)-1) - p.*x.^4;
Li = polylog(4,exp(0));
cv3 = cv2 - Li;
2 comentarios
Muhammad Usman
el 14 de Dic. de 2021
The error you were getting due to:
syms x T xd
But you defined T as linscpace and xd depends on T and they were both 1x400 double array, but x was defined as symbol so that makes cv2 and cv3 1x400 symbol
Respuestas (1)
Walter Roberson
el 14 de Dic. de 2021
clc
clear all
syms x T xd
Tvals = linspace(12,1000,400);
kb = 1.38*10^-23;
xd = T/2240;
h = 6.64*10^-34;
v = 18000;
p = 6.*kb.^4*T.^3./(pi.^2*h.^3*v.^3);
%y = x^4*exp(x)/(exp(x)-1)^2;
%cv = p.*24.*(x.^3.*log(exp(x)-1)./6 + polylog(4,exp(x)) - x.*polylog(3,exp(x)) + x.^2.*polylog(2,exp(x))/2) - p.*x.^4./(exp(x)-1) - p.*x.^4;
cv2 = p.*24.*(xd.^3.*log(exp(xd)-1)./6 + polylog(4,exp(xd)) - x.*polylog(3,exp(xd)) + x.^2.*polylog(2,exp(xd))/2) - p.*x.^4./(exp(xd)-1) - p.*x.^4;
Li = polylog(4,exp(0));
cv3(x,T) = cv2 - Li;
result = cv3(x,Tvals);
rv = vpa(result, 8);
rv(1:2).'
result would be a 1 x 400 expression involving the variable x
3 comentarios
Walter Roberson
el 15 de Dic. de 2021
What size of output are you expecting? You have a function that has a different formula at each time point; it appears that it can be approximated as a complex quartic at each time.
If you create a column vector of x values, and subs() that in for x in result then you would get a 2D array with one row for each different x value, and with 400 columns (one for each time.)
Ver también
Categorías
Más información sobre Conversion Between Symbolic and Numeric en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!