採用された回答

Walter Roberson
Walter Roberson 2021 年 8 月 19 日

0 投票

Yes, you could replace the following symsum() with a loop that totaled over m
syms m t r positive
syms r__prime real
Pi = sym(pi)
Pi = 
π
V_r_t = symsum(exp(m*Pi*t)*sin(m*Pi*r)*int(r__prime*sin(m*Pi*r),r__prime,0,1),m,1,10)
V_r_t = 

4 件のコメント

Walter Roberson
Walter Roberson 2021 年 8 月 19 日
This assumes that is a variable that is independent of r rather than being the derivative of r.
Bajdar Nouredine
Bajdar Nouredine 2021 年 8 月 20 日
dear @Walter Roberson thank you very much
how can I add loop if I have intervals for both r and t for example
r= [1,10] and
t= [1,10] ?
Walter Roberson
Walter Roberson 2021 年 8 月 20 日
syms m t r positive
syms r__prime real
Pi = sym(pi)
Pi = 
π
V_r_t = symsum(exp(m*Pi*t)*sin(m*Pi*r)*int(r__prime*sin(m*Pi*r),r__prime,0,1),m,1,10)
V_r_t = 
r_vec = 1:10;
t_vec = 1:10;
[R,T] = ndgrid(r_vec,t_vec);
V = subs(V_r_t, {r, t}, {R, T})
V = 
Reminder: sin(INTEGER*pi) is 0, and all of the terms of V_r_t have INTEGER*pi*r and all of your r are integer.
Bajdar Nouredine
Bajdar Nouredine 2021 年 8 月 23 日

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by