Matlab求救!!!分段函数积分问题

lovec001 2014-05-04 07:20:58
[code=text][code=c][code=text]
R=5, Nt=4, alpha=pi/6; % Parameters about the mill
ar=7.5, ap=5, ft=0.1; % Cutting parameters
kts=500, krs=500, kas=500; % Sheer cutting force coefficient in tangential, radial, axial direction, respectively
ktp=500, krp=500, kap=500; % Plough cutting force coefficient in tangential, radial, axial direction, respectively
delta=2*pi/Nt; % The tooth space angle
phi0=acos((R-ar)/R); % Milling angle, which equals ?ex minus ?st
phi_st=pi-phi0, phi_ex=pi; % Start and exit cutting angle
syms theta; % Cutting edge position

% Force elements of x,y,z direction
dFx=(ft*sin(theta)*cos(theta)*kts+ft*(sin(theta))^2*krs+cos(theta)*ktp+sin(theta)*krp)*R/tan(alpha);
dFy=(-ft*(sin(theta)^2)*kts+ft*sin(theta)*cos(theta)*krs-sin(theta)*ktp+cos(theta)*krp)*R/tan(alpha);
dFz=(ft*sin(theta)*kas+kap)*R/tan(alpha);

angle=0:0.01:2*pi;
N=length(angle);
% Fx1=zeros(size(theta));Fx2=zeros(size(theta));Fx3=zeros(size(theta));
% Fy1=zeros(size(theta));Fy2=zeros(size(theta));Fy3=zeros(size(theta));
% Fz1=zeros(size(theta));Fz2=zeros(size(theta));Fz3=zeros(size(theta));
% Integrate the functions above% Find the interation limits of Fx,y,z
for k=1:N
if angle(k)>= phi_st && angle(k)< phi_st + delta
Fx1=int(dFx,theta,theta-phi_st,phi_st);
Fy1=int(dFy,theta,theta-phi_st,phi_st);
Fz1=int(dFz,theta,theta-phi_st,phi_st);
elseif angle(k)>= phi_st + delta && angle(k)< phi_ex
Fx2=int(dFx,theta,phi_st+delta,phi_ex);
Fy2=int(dFx,theta,phi_st+delta,phi_ex);
Fz2=int(dFx,theta,phi_st+delta,phi_ex);
elseif angle(k)>= phi_ex && angle(k)<= phi_ex + delta
Fx3=int(dFx,theta,phi_ex,phi_ex+delta);
Fy3=int(dFy,theta,phi_ex,phi_ex+delta);
Fz3=int(dFz,theta,phi_ex,phi_ex+delta);
end
end
Fx=Fx1+Fx2+Fx3;
Fy=Fy1+Fy2+Fy3;
Fz=Fz1+Fz2+Fz3;
% Display the graphs of Fx,y,z
theta=0:pi/10:2*pi;
plot(theta,Fx)
hold on
plot(theta,Fy)
hold on
plot(theta,Fz)
[/code][/code][/code]

我的思路是,Fx1, Fx2, Fx3是Fx在0--2pi上的分段函数。在0--2pi上对dF分段积分后得到Fx1, Fx2, Fx3,最后输出Fx图像,Fy,Fz同理。下面有个分段函数的例子。
  x=-3:0.01:3;
% y1=zeros(size(x));
% y2=zeros(size(x));
% y3=zeros(size(x));
N=length(x);
for k=1:N
if x(k)<-1&x(k)>=-3;
y1(k)=(-x(k).^2-4*x(k)-3)/2;
elseif x(k)>=-1&x(k)<1 ;
y2(k)=-x(k).^2+1;
else x(k)<=3&x(k)>=1 ;
y3(k)=(-x(k).^2+4*x(k)-3)/2;
end
end
y=y1+y2+y3;
plot(x,y)
...全文
464 点赞 收藏 回复
写回复
回复

还没有回复,快来抢沙发~

发动态
发帖子
人工智能技术
创建于2007-08-27

1921

社区成员

2925

社区内容

专题开发/技术/项目 人工智能技术
社区公告
暂无公告