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일
1 개 추천
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
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
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!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 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)
