检查一下哪里错了 MATLABsyms x y=log(x)/x;d1=diff(y);d2=diff(d1);x=0:0.2:20;axis([0,20,-9 1]);plot(x,y),grid onhold onx1=fzero(d1,[0,20]);plot(x1,y1,'*')text(x1,y1,'极大值点')hold onx2=fzero(d2,[0,20]);plot(x2,y2,'r*')text(x2,y2,'拐点')
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/19 20:10:24
检查一下哪里错了 MATLABsyms x y=log(x)/x;d1=diff(y);d2=diff(d1);x=0:0.2:20;axis([0,20,-9 1]);plot(x,y),grid onhold onx1=fzero(d1,[0,20]);plot(x1,y1,'*')text(x1,y1,'极大值点')hold onx2=fzero(d2,[0,20]);plot(x2,y2,'r*')text(x2,y2,'拐点')
检查一下哪里错了 MATLAB
syms x
y=log(x)/x;
d1=diff(y);d2=diff(d1);
x=0:0.2:20;axis([0,20,-9 1]);
plot(x,y),grid on
hold on
x1=fzero(d1,[0,20]);
plot(x1,y1,'*')
text(x1,y1,'极大值点')
hold on
x2=fzero(d2,[0,20]);
plot(x2,y2,'r*')
text(x2,y2,'拐点')
检查一下哪里错了 MATLABsyms x y=log(x)/x;d1=diff(y);d2=diff(d1);x=0:0.2:20;axis([0,20,-9 1]);plot(x,y),grid onhold onx1=fzero(d1,[0,20]);plot(x1,y1,'*')text(x1,y1,'极大值点')hold onx2=fzero(d2,[0,20]);plot(x2,y2,'r*')text(x2,y2,'拐点')
我给你写一个算了
close all
clear,clc
syms x
f=@(x)log(x)./x;
eval(['f1=@(x)' char(diff(f(x))),';','f2=@(x)' char(diff(f(x),2)),';']);
span=[0.1,20];
x1=fzero(f1,span);x2=fzero(f2,span);
x=0:.1:20;
y=f(x);
y1=f(x1);y2=f(x2);
plot(x,y,x1,y2,'ro',x2,y2,'go','linewidth',2,'markersize',7)
h=legend('$\ y=\frac{\ln(x)}{x}$','$\frac{d}{dx}(\frac{\ln(x)}{x})=0$','$\frac{d^2}{dx^2}(\frac{\ln(x)}{x})=0$','Location','Best');
set(h,'interpreter','latex','fontsize',14)
grid on;axis([0,20,-3 1]);