遗忘海岸

江湖程序员 -Feiph(LM战士)

导航

一个函数与其导数的图象绘制

 

% x*(1-x)^(2/5)
% 对上面函数求导

% 2/5 2 x
% (1 - x) - ------------
% 3/5
% 5 (1 - x)

%该式在x>1 时由于 3/5次方存在变的无意义
%所以要使用下面的等价形式求导
diff(x*(x-1)^(2/5)) %当x>1时函数等价形式

ezplot('(2*x)/(5*(x - 1)^(3/5)) + (x - 1)^(2/5)',[1.01,2])

 

//==============绘制曲线与曲线指定点密切圆======================

clc
clear
close
format long
syms x y
t0=1.001;
t=-1:0.001:5;
x1=t;
y1=t.*(t-1).^(2/5);
z1=t*0;
plot(x1,y1);
hold on
Rx0=t0;
Ry0=t0*(t0-1)^(2/5);
plot(Rx0,Ry0,'*');

grid on
axis equal



df=diff(x);
dg=diff(x*(x-1)^(2/5));
df2=diff(df);
dg2=diff(dg);
k=abs(df*dg2-dg*df2) / (df^2+dg^2)^(3/2);
% pretty(k)
kt0=subs(k,t0);
df0=subs(df,t0);
dg0=subs(dg,t0);
Nx0=dg0/sqrt(dg0^2+df0^2);
Ny0=-df0/sqrt(dg0^2+df0^2);

Cx0=Rx0 + (1/kt0) *Nx0;
Cy0=Ry0 + (1/kt0) *Ny0;
plot(Cx0,Cy0,'*')

x2=Cx0+cos(t)*(1/kt0);
y2=Cy0+sin(t)*(1/kt0);
plot(x2,y2);
double(kt0)
%n=-dg i+df j
%n=dg i- df j

% eval(solve('3*t/sqrt(1+t^2)=2.281'))
View Code

 

posted on 2017-03-10 14:39  遗忘海岸  阅读(702)  评论(0编辑  收藏  举报