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

답변 (1개)

Andrei Bobrov
Andrei Bobrov 2011년 10월 19일

0 개 추천

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)

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

질문:

2011년 10월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by