Double summation in matlab
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
1 投票
I would like to do this double summation
. where alpha=2; beta=1.5;
I am confuse about the command availbale in online .Pl somebody help me what is way of solving this summation.
1 件のコメント
Walter Roberson
2020 年 3 月 5 日
Because you used addition here where the original question used multiplication.
採用された回答
Mohammad Sami
2020 年 3 月 5 日
You can define a function to calculate the expression inside the brackets.
a = @(p,param)param.^p./factorial(p); % (param^n)/factorial(n)
% param is alpha or beta, p = n or m
sum(sum(a(0:10,2)' * a(0:15,1.5)))
11 件のコメント
AVM
2020 年 3 月 5 日
Thanks. Then shall I have to do it separtely? and then multiply the two things?
AVM
2020 年 3 月 5 日
Pl give the complete coding if possible.
AVM
2020 年 3 月 5 日
clc;
clear;
syms n m
alpha=2;
beta=2;
f=@(n,m)(alpha.^n)+(beta.^m);
symsum(symsum(f,n,0,3),m,0,3)
Why this coding gives the result 120 insted of 30. Pl help me.
Mohammad Sami
2020 年 3 月 5 日
This is missing the factorial in the divisor.
Mohammad Sami
2020 年 3 月 5 日
Its already complete. I just put the multiplication and sum in one line
Mohammad Sami
2020 年 3 月 5 日
I think 120 is the correct answer.
a = @(p,param)param.^p; % (param^n)/factorial(n)
% param is alpha or beta, p = n or m
sum(sum(a(0:3,2)' + a(0:3,2)))
I don't have the symbolic toolbox myself so can't test it.
I have cross checked with https://www.wolframalpha.com/input/?i=sum+2%5Ek+%2B+2%5El%2C+k%3D0+to+3%2C+l+%3D0+to+3
AVM
2020 年 3 月 5 日
@sami: Thanks. Actually I was wrong. I have done a mistake in analytic calcualtion. It's working.
@Sami: I am trying to solve the following case according to your code of my previous problem, I am little bit confuse how to handle it. Pl help me.
clc;
clear;
syms alpha r1 theta mu nu lambda t n1 m1 theta2
r2=1.0;
theta2=2.0;
alpha1=0.5;
alpha2=1.0;
lambda=2.0;
omega=1;
phi=pi/3;
mu=cosh(r2);
nu=exp(1i*theta2).*sinh(r2);
f=((((alpha1.*exp(-1i*omega*t))*r1.*exp(-1i*theta)).^(n1))*(((alpha1.*exp(1i*omega*t))*r1.*exp(1i*theta)).^(m1))./(factorial(m1).*factorial(n1))).*...
1./sqrt((((mu).^2)-((abs(nu)).^2).*exp(-2*1i*lambda*t*(n1-m1)))).*...
exp(((1./mu).*exp(-2*1i*lambda*t*(n1-m1)).*real(((alpha2).^2)*conj(nu))+((alpha2).^2).*(exp(-1i*lambda*t*(n1-m1))))./...
(((mu).^2)-((abs(nu)).^2).*exp(-2*1i*lambda*t*(n1-m1))));
Now I would like to evaluate this double summation fucntion 'f' over n1 and m1 from 0 to 20 each of them. Pl help me to do that
Mohammad Sami
2020 年 3 月 5 日
I believe you should be able to solve this with the symbolic toolbox. I dont have the toolbox to check if it works.
Similar to what you posted earlier. Since only m1, n1 and t don't have a fixed value, only declare those as symbols.
Declare f as a function.
% your ealier post.
syms n m
alpha=2;
beta=2;
f=@(n,m)(alpha.^n)+(beta.^m);
symsum(symsum(f,n,0,3),m,0,3)
for the current question
syms n1 m1 t
r2=1.0;
theta2=2.0;
alpha1=0.5;
alpha2=1.0;
lambda=2.0;
omega=1;
phi=pi/3;
mu=cosh(r2);
nu=exp(1i*theta2).*sinh(r2);
f=@(n1,m1)((((alpha1.*exp(-1i*omega*t))*r1.*exp(-1i*theta)).^(n1))*(((alpha1.*exp(1i*omega*t))*r1.*exp(1i*theta)).^(m1))./(factorial(m1).*factorial(n1))).*...
1./sqrt((((mu).^2)-((abs(nu)).^2).*exp(-2*1i*lambda*t*(n1-m1)))).*...
exp(((1./mu).*exp(-2*1i*lambda*t*(n1-m1)).*real(((alpha2).^2)*conj(nu))+((alpha2).^2).*(exp(-1i*lambda*t*(n1-m1))))./...
(((mu).^2)-((abs(nu)).^2).*exp(-2*1i*lambda*t*(n1-m1))));
symsum(symsum(f,n1,0,20),m1,0,20)
Atrolita afra
2020 年 3 月 29 日

Atrolita afra
2020 年 3 月 29 日

その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Dates and Time についてさらに検索
タグ
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
