sum and plot of symbolic error functions

9 ビュー (過去 30 日間)
Hiep Hoang
Hiep Hoang 2018 年 2 月 2 日
コメント済み: Hiep Hoang 2018 年 2 月 2 日
I have to plot a summation of series of error functions like in the following code. The value of variable n changes from negative infinity to positive infinity. I just denote them as -1000 and 1000. My program can not produce results and I can not plot either. My program is below. Thank you! I really appreciate your support!
w=70*10^-6;
h=w/2;
D=3.3*10^-10;
t=10^-5;
Co=10^-6;
syms n x
symsum(erf((h+2*n*w-x)/sqrt(4*D*t))+erf((h-2*n*w+x)/sqrt(4*D*t)),n,-1000,1000)
ezplot(ans)

採用された回答

Walter Roberson
Walter Roberson 2018 年 2 月 2 日
symsum recognizes that there is no good formula for that summation, and leaves a place-holder .
Note that symsum() is for attempting to construct a closed-form formula. If it does not find a useful one, then it returns symsum(). If you instead wanted it to return 2001 erf() functions added together, then instead of symsum() you should subs() -1000:1000 for n into the expression, and then sum() the result. It will be an ugly result with no practical use, though.
Now if you were to switch from discrete to continuous, int() of that formula is resolvable.
  1 件のコメント
Hiep Hoang
Hiep Hoang 2018 年 2 月 2 日
Thanks Walter Roberson. I got nice results without using symsum anymore. Here is the code:
w=70*10^-6;
h=w/2;
D=3.3*10^-10;
t=10^-5;
Co=10^-6;
for n=1:100000
c(n)=(Co/2)*(erf((h+2*n*w-x)/sqrt(4*D*t))+erf((h-2*n*w+x)/sqrt(4*D*t)));
b(n)=(Co/2)*(erf((h-2*n*w-x)/sqrt(4*D*t))+erf((h+2*n*w+x)/sqrt(4*D*t)));
a=(Co/2)*(erf((h-x)/sqrt(4*D*t))+erf((h+x)/sqrt(4*D*t)))
S=c(n)+b(n)+a;
end

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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