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
2011-10-19
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 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!