How can I write this equation into MATLAB script

3 ビュー (過去 30 日間)
Lauren Maher
Lauren Maher 2019 年 9 月 16 日
コメント済み: Lauren Maher 2019 年 9 月 24 日
001.PNG
  2 件のコメント
dpb
dpb 2019 年 9 月 16 日
You could try the symbolic toolbox but I don't know how successful it'll be.
Basically, you need to write a function that computes enough terms of the series that it converges to some chosen level of accuracy.
Lauren Maher
Lauren Maher 2019 年 9 月 24 日
Thank you!

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

回答 (1 件)

Jyothis Gireesh
Jyothis Gireesh 2019 年 9 月 19 日
Symbolic Math Toolbox may be used to implement the above equation in MATLAB. Here are a few suggestions which may be helpful in the implementation
  • Declare n as a symbolic variable and N as a symbolic function of two variables x and t using the following syntax
syms n N(x,t)
  • To implement the summation term, use the following code
F = exp(-((2*n+1)*pi)^2*D*t/L^2)*sin((2*n+1)*pi*x/L)/((2*n+1)*pi^3);
Fsum = symsum(F,n,0,inf);
Here n is replaced by 2n+1 so that only odd terms are considered in the summation.
The function symsum()” sets the limits of summation from 0 to inf.
Remaining terms can be written as normal equation in MATLAB
Please use the following documentation links on how to create symbolic functions and symsum()” to get a better understanding

カテゴリ

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