I am trying to a series generated from complex function but it gives to me an error.

1 回表示 (過去 30 日間)
Elsayed Barakat
Elsayed Barakat 2022 年 5 月 1 日
編集済み: VBBV 2022 年 5 月 1 日
clear;
clc;
syms k
Delta=0;
chi=0;
theta=0;
alpha=5;
phi=0;
bn=exp(-0.5*alpha^2)*(alpha^k)/sqrt(gamma(k+1));
bn1=exp(-0.5*alpha^2)*(alpha^(k+1))/sqrt(gamma(k+2));
t = 0:pi/100:2*pi;
Gamma=chi*k^2-0.5*Delta;
Wn=0.5*Delta-chi*k;
mu=sqrt((0.5*Delta-chi*k)+k+1);
An=exp(-1i*Gamma*t)*(bn*cos(theta/2)*(cos(mu*t)-1i*Wn*sin(mu*t)/mu)-1i*bn1*sqrt(k+1)*sin(theta/2)*exp(-1i*phi)*sin(mu*t)/mu);
zz=real(An)^2+2*imag(An);
y1 = symsum(zz,k, 0, 20);
plot(t,y1,'r','Color',[0.5 0 0.8])
Error using mupadmex
Error in MuPAD command: The dimensions do not match. [(Dom::Matrix(Dom::ExpressionField()))::_mult2]
Error in sym/privBinaryOp (line 820)
Csym = mupadmex(op,args{1}.s, args{2}.s, varargin{:});
Error in * (line 216)
X = privBinaryOp(A, B, 'symobj::mtimes');
Error in Untitled222 (line 17)
An=exp(-1i*Gamma*t)*(bn*cos(theta/2)*(cos(mu*t)-1i*Wn*sin(mu*t)/mu)-1i*bn1*sqrt(k+1)*sin(theta/2)*exp(-1i*phi)*sin(mu*t)/mu);
>>

回答 (1 件)

VBBV
VBBV 2022 年 5 月 1 日
編集済み: VBBV 2022 年 5 月 1 日
clear;
clc;
syms k
Delta=0;
chi=0;
theta=0;
alpha=5;
phi=0;
bn=exp(-0.5*alpha^2)*(alpha^k)/sqrt(gamma(k+1));
bn1=exp(-0.5*alpha^2)*(alpha^(k+1))/sqrt(gamma(k+2));
t = 0:pi/100:2*pi;
Gamma=chi*k^2-0.5*Delta;
Wn=0.5*Delta-chi*k;
mu=sqrt((0.5*Delta-chi*k)+k+1);
An=exp(-1i*Gamma*t).*(bn*cos(theta/2).*(cos(mu*t)-1i*Wn.*sin(mu*t)./mu)-1i*bn1*sqrt(k+1)*sin(theta/2)*exp(-1i*phi).*sin(mu*t)./mu);
zz=real(An).^2+2*imag(An);
y1 = symsum(zz,k, 0, 20);
plot(t,y1,'r','Color',[0.5 0 0.8])
  1 件のコメント
VBBV
VBBV 2022 年 5 月 1 日
編集済み: VBBV 2022 年 5 月 1 日
Matlab uses elementwise operator ./ .* for multiplying or dividing one or more multidimensonal vectors

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by