📄 exm020304.m
字号:
clear
syms x
syms d positive
f_p=sin(x); %
df_p=limit((subs(f_p,x,x+d)-f_p)/d,d,0) % <4>
df_p0=limit((subs(f_p,x,d)-subs(f_p,x,0))/d,d,0) % <5>
f_n=sin(-x);
df_n=limit((f_n-subs(f_n,x,x-d))/d,d,0) % <7>
df_n0=limit((subs(f_n,x,0)-subs(f_n,x,-d))/d,d,0) %<8>
f=sin(abs(x));
dfdx=diff(f,x) % <10>
xn=-3/2*pi:pi/50:0;xp=0:pi/50:3/2*pi;xnp=[xn,xp(2:end)];
hold on
plot(xnp,subs(f,x,xnp),'k','LineWidth',2.5) % <13>
plot(xn,subs(df_n,x,xn),'--r','LineWidth',2.5)
plot(xp,subs(df_p,x,xp),':r','LineWidth',2.5)
legend(char(f),char(df_n),char(df_p),'Location','NorthEast')% <16>
grid on
xlabel('x')
hold off
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -