Assigning values to variables after using isolate?
2 次查看(过去 30 天)
显示 更早的评论
Here is my code:
%% Model
syms M n D t r
eqn = M - (1 - 6/(pi^2)) * symsum((1/n^2 * exp((-D*n^2*pi^2*t)/(r^2))),n,0,Inf) == 0;
%% Variables
t = [0.50373, 43.2325, 86.72428, 129.74978, 173.8774, 216.69095];
M = [0.75233, 62.53212, 67.84044, 67.6522, 80.90417, 82.59832];
r = 130/(10^9);
Dsol = isolate(eqn, D)
disp(Dsol)
However, the output is just the solution to Dsol and not the actual array of Dsol values. How can I assign the values to t, M, and r to obtain an array for Dsol?
0 个评论
回答(1 个)
Devineni Aslesha
2020-6-22
In your code, check with the symsum function as it do not return the sum of the series((-D*n^2*pi^2*t)/(r^2))) with respect to the summation index n. You can use the subs function to get the actual array of Dsol values as shown below.
subs(rhs(Dsol),{t,M,r},{t1,M1,r1});
Here, t1 = [0.50373, 43.2325, 86.72428, 129.74978, 173.8774, 216.69095]
M1 = [0.75233, 62.53212, 67.84044, 67.6522, 80.90417, 82.59832] and
r1 = 130/(10^9);
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!