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

1 view (last 30 days)
Elsayed Barakat
Elsayed Barakat on 1 May 2022
Edited: VBBV on 1 May 2022
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);
>>

Answers (1)

VBBV
VBBV on 1 May 2022
Edited: VBBV on 1 May 2022
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 Comment
VBBV
VBBV on 1 May 2022
Matlab uses elementwise operator ./ .* for multiplying or dividing one or more multidimensonal vectors

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!