How do I write the following summation for power series in code ?

8 ビュー (過去 30 日間)
EMIL RAJAN VARGHESE
EMIL RAJAN VARGHESE 2023 年 6 月 26 日
I need to solve for the above power series and plot the solutions from the above formula against radius.
'a' is the coefficeint in the power series and 'p' is a dimensionless radial coordinate, n= 0 ,1,2, ..., infinity.'q' is a pressure term.
Also, I have found the values of 'a' for a0 , a2 , a4 , so how do I code the above formula such that the specific values of 'a' are called as well as the summation is done?
  2 件のコメント
John D'Errico
John D'Errico 2023 年 6 月 26 日
編集済み: John D'Errico 2023 年 6 月 26 日
DON'T create a list of variables named a0 a2 a4, etc. Instead, learn to use vectors.
But once you have done that, surely you know how to write a loop and form a sum?
EMIL RAJAN VARGHESE
EMIL RAJAN VARGHESE 2023 年 7 月 10 日
Thanks this was great help

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

採用された回答

Arya Chandan Reddy
Arya Chandan Reddy 2023 年 6 月 29 日
Hi, I understand that you are trying to compute the above function for a specific value of 'p' . Assuming that you have coefficients stored in an array in the format
a = [a0 a2 a4 so on..];
You can try to sum first 100 terms or till the available coefficients.
Here is the code for it
for i = 1:size(a)
Wp = Wp + a(i)*(1 - p^(2*i +2));
end
Wp = Wp * q^(2/3);
Hope it helps

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by