Assigning values to variables after using isolate?

2 ビュー (過去 30 日間)
Ananya Sahu
Ananya Sahu 2020 年 6 月 19 日
回答済み: Devineni Aslesha 2020 年 6 月 22 日
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?

回答 (1 件)

Devineni Aslesha
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);
For more information, refer Substitute Multiple Scalars with Arrays from this link

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by