主题:函数的嵌套调用怎么用?
function [x1,y1]=incipience(r0,e,h,rr)
s0=(r0^2-e^2)^0.5;
s=myfile1(t);
x=myfile2(s,t);y=myfile3(s,t);
alpha=myfile4(s,t);
k=myfile5(t);l=myfile6(t);
p=myfile7(t);
x1=myfile8(x,l);y1=myfile9(y,k);
function x1=myfile8(x,l)
x1=x+(-1)^n*rr*l;
end
function y1=myfile9(y,k)
y1=y+(-1)^n*rr*k;
end
function k=myfile5(t)
k=dx/(dx^2+dy^2)^0.5;
end
function l=myfile6(t)
l=-dy/(dx^2+dy^2)^0.5;
end
function x=myfile2(s,t)
x=(s0+s)*sin(t)+e*cos(t);
end
function y=myfile3(s,t)
y=(s0+s)*cos(t)-e*sin(t);
end
function s=myfile1(t)
switch myfile1(t)
case 0<=t<2*pi/3
s=h*(3*t/2*pi-sin(3*t)/2*pi)
case 2*pi/3<=t<5*pi/6
s=50
case 5*pi/6<=t<7*pi/6
s=h*(1+cos(3*t))/2
case 7*pi/6<=t<2*pi
s=0
end
function alpha=myfile4(s,t)
alpha=(ds-e)/(s0+s);
function p=myfile7(t)
m1=dx;n1=dy;
m2=dm1;n2=dn1;
p=(m2+n2)^1.5/(m1*n2-m2*n1);
if min(alpha)>pi/6
disp('wujie'),return;
else if min(p)<=rr
n=0;
else
n=0,1;
end
end
for t=0:0.1:2*pi plot(x1,y1,'r')
end
请高手指点:怎么嵌套后能把x1,y1的图像画出来?谢谢!!!
[em15][em15]
s0=(r0^2-e^2)^0.5;
s=myfile1(t);
x=myfile2(s,t);y=myfile3(s,t);
alpha=myfile4(s,t);
k=myfile5(t);l=myfile6(t);
p=myfile7(t);
x1=myfile8(x,l);y1=myfile9(y,k);
function x1=myfile8(x,l)
x1=x+(-1)^n*rr*l;
end
function y1=myfile9(y,k)
y1=y+(-1)^n*rr*k;
end
function k=myfile5(t)
k=dx/(dx^2+dy^2)^0.5;
end
function l=myfile6(t)
l=-dy/(dx^2+dy^2)^0.5;
end
function x=myfile2(s,t)
x=(s0+s)*sin(t)+e*cos(t);
end
function y=myfile3(s,t)
y=(s0+s)*cos(t)-e*sin(t);
end
function s=myfile1(t)
switch myfile1(t)
case 0<=t<2*pi/3
s=h*(3*t/2*pi-sin(3*t)/2*pi)
case 2*pi/3<=t<5*pi/6
s=50
case 5*pi/6<=t<7*pi/6
s=h*(1+cos(3*t))/2
case 7*pi/6<=t<2*pi
s=0
end
function alpha=myfile4(s,t)
alpha=(ds-e)/(s0+s);
function p=myfile7(t)
m1=dx;n1=dy;
m2=dm1;n2=dn1;
p=(m2+n2)^1.5/(m1*n2-m2*n1);
if min(alpha)>pi/6
disp('wujie'),return;
else if min(p)<=rr
n=0;
else
n=0,1;
end
end
for t=0:0.1:2*pi plot(x1,y1,'r')
end
请高手指点:怎么嵌套后能把x1,y1的图像画出来?谢谢!!!
[em15][em15]