车削端面的表面微观形貌仿真(matlab)

代码段禁止出现在毕业设计、商业活动中!仅供交流。

代码段

相关参数已在代码中标注,由于是自己参考论文编写的并且才接触matlab不到一周,因此采用的比较多的循环结构,程序某些地方可能多余(懒得删除),而且程序运行比较慢,大家可以参考自己进行优化。

%% initialization
clear;
close all;
clc;

%% known conditions
n = 500; %Spindle speed of lathe,r/min		主轴转速
Rdt = 1.554; %Radius of arc knife,mm			刀尖圆弧半径
s = 15; %Spindle feed speed,mm/min			主轴进给速度
h = 2/1000; %Depth of cut,mm					加工深度

%% Assumptions
Rw = 0.5;%Workpiece radius,mm				工件半径
Lx = 0.25;%The length of the simulation area,mm		加工长度
Ly = 0.25;%Width of simulation area,mm						加工宽度
Sf = s/n; %Feed per revolution,mm/r			进给速度(注意单位)
mx = Sf/10;
my = Sf/10;
N = ceil(Lx/mx);
M = ceil(Rw/Sf);

% Overall surface roughness
Rt = Rdt - sqrt(Rdt^2-(Sf^2)/4);			%总的表面粗糙度

%% Set matrix
AA = [];
k = 0:1:M;
rk = [];

%% Calculate profile height
for i = 0:N
    for j = 0:N
        %Cartesian coordinates of points
        Xij = i*mx-Lx/2;
        Yij = j*my-Ly/2;
        
        %Point polar coordinates
        r = sqrt(Xij^2+Yij^2);
        theta = atan(Yij/Xij);
        
        % jidge theta
        if theta < 0
            theta = theta +2*pi;
        elseif theta >= 2*pi
            theta = theta -2*pi;
        else
            theta = theta;
        end
        
        %compute the height of the point
        hk = [];
        for k = 1:M
            if i < N/2
            rk = Rw - Sf*(k + theta/(2*pi));
            else
                rk = Rw - Sf*((k-0.5) + theta/(2*pi));
            end
            hk1 = Rdt*(1-(sqrt(1-((r-rk)/Rdt)^2)));
            hk = [hk,hk1];
        end
            hklow = min(min(hk));
            
             % Judge height and processing depth
        if hklow > h
            hklow = h;
        end

        % save the min height
        AA = [AA,hklow];
        
    end
end
%List the coordinate range
Ax = linspace(0,0.25,N+1);
Ay = Ax;

% Into a square
AA = reshape(AA,[N+1,N+1]);

% Drawing
surf(Ay,Ax,AA);
title('Surface microtopography');
xlabel('x-axis');
ylabel('y-axis');
zlabel('z-axis');

效果验证

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

参考文献

[1]尹自强,李圣怡.振动影响下金刚石车削表面的形貌仿真[J].国防科技大学学报,2003(01):78-83.
[2]尹自强,李圣怡.超精密车削表面三维微观形貌仿真及特征分析[J].航空精密制造技术,2003(04):1-5.

备注

1、编写程序时,任务要求没有加入振动影响,因此在此忽略了振动因素对表面粗糙度的影响。

2、轻喷代码,新手练习的。

3、不得在毕业设计、商业中出现该代码段,优化/更改后的可以。

有问题请留言,会及时回复的。

评论 17
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值