Assigning values to variables after using isolate?

조회 수: 8 (최근 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 CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by