calcul of Taylor approximation+ sum using syms
Afficher commentaires plus anciens
Here below my program. I would like to calculate the taylor approximation of R near kx0. and woul like to calculate the sum of sigma power n.
It works well but for order more than3 doesn't work . Furthermore, for some values of theta doesn't work and displays the error you find here.( for a value of theta + 1.58, it dosn't displays this error).
Any one has an idea??
Thank you in advance!
Adam
clear all;
lambda=3E-6;
k1=2*pi/lambda;
n=3.42;
theta=((asin(1/n))*180)/pi;
w0=10E-3;
k2=k1/n;
q=1;
syms kx sigma u
kx0=k1*sin(theta);
sigma=-(kx-k1.*sin(theta))./(k1.*cos(theta));
R=((k1^2-kx^2)^(1/2)-q*(k2^2-kx^2)^(1/2))/((k1^2-kx^2)^(1/2)+q*(k2^2-kx^2)^(1/2))% Reflectance R
syms kx sigma u clear
t1=taylor(R,kx,kx0,'Order', 1)
p=symsum(sigma^u, u, 0, 0)
Bn=t1./p
vall=subs(R,kx0)
val1=subs(t1,kx0)
val2=subs(p,kx0)
val3=subs(Bn,kx0)
val4=val1/val2
Error using mupadmex
Error in MuPAD command: Cannot compute a Taylor expansion of -((1536119361583697/4096 - kx^2)^(1/2) -
(8983533250413779/2048 - kx^2)^(1/2))/((1536119361583697/4096 - kx^2)^(1/2) + (8983533250413779/2048 - kx^2)^(1/2)).
Try 'series' for a more general expansion. [taylor]
Error in sym/taylor (line 142)
tSym = mupadmex('symobj::taylor',f.s,x.s,a.s,options);
Error in reflexiontotale2 (line 19)
t1=taylor(R,kx,kx0,'Order', 1)
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Common Operations dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!