symbolic calculation - subs does not work after diff

In the following code I create a symbolc expression. I want to differentiate it and after that I want to evaluate it at specific datapoints. The evaluation works before the diff command but not afterwards. In other examples this works well but not in the one shown below. Any ideas?
syms x
A=1;
B=2;
D=1;
C=3;
E=A+(B*C^2)./(B^2-x.^2-1i.*C.*x);
n=sqrt((sqrt(real(E).^2+imag(E).^2)+real(E))./2);
y=10:1:300;
nN=subs(n,x,y);
plot(y,nN)
dn=diff(n);
dnN=subs(dn,x,y)
plot(y,dnN)
Thanks, Dirk

Respuestas (1)

Andrei Bobrov
Andrei Bobrov el 19 de Oct. de 2011
syms x real
A=1;
B=2;
D=1;
C=3;
E=A+(B*C^2)./(B^2-x.^2-1i.*C.*x);
n=sqrt((sqrt(real(E).^2+imag(E).^2)+real(E))./2);
y=10:1:300;
nN=subs(n,x,y);
plot(y,nN)
dn=diff(n);
dnN=subs(dn,x,y)
plot(y,dnN)

Categorías

Más información sobre Symbolic Math Toolbox en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 19 de Oct. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by