clear
syms x;
num=3*x^2+6*x-1;
denom=x^2+x-3;
f=num/denom;
ezplot(f)
hold on
inf_ans=limit(f,inf); %x趋于正无穷时,函数的极限
roots=solve(denom); %返回分母的解,求出垂直渐近线
%水平渐近线
plot([-8,8],[double(inf_ans),double(inf_ans)],'g')
%垂直渐近线
plot([double(roots(1)),double(roots(1))],[-10,10],'r')
plot([double(roots(2)),double(roots(2))],[-10,10],'r')
title('函数的渐近线')
%极值点
f1=diff(f);
max_point=solve(f1);
figure
ezplot(f)
hold on
plot(double(max_point),double(subs(f,max_point)),'ro')
title('函数的极大值和极小值')
text([-5,-2.5],[3.5,2],['局部极小值';'局部极大值'])
%拐点
f2=diff(f1);
inflection_point=solve(f2);
inflection_point=double(inflection_point);
figure
ezplot(f)
hold on
plot(inflection_point(1),subs(f,x,inflection_point(1)),'mo')
title('函数的拐点')
text(-6,3.5,'拐点')
hold off
msgbox('MATLAB编程答疑,请加QQ: 1530497909','MATLAB答疑','help')
web http://url.cn/TKcdXk -browser