机械精度实验_第1页
机械精度实验_第2页
机械精度实验_第3页
机械精度实验_第4页
机械精度实验_第5页
已阅读5页,还剩10页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Calculating flatness with least square method1. Matlab code:clcclearA=xlsread(flatness,1; for i=1:size(A,1 for j=1:size(A,2 if isnan(A(i,j A(i,j=0;endendend x,y,z=find(A; t=x,y; b=regress(z,t; X,Y=meshgrid(1:size(A,1,1:size(A,2; mesh(X,Y,b(1*X+b(2*Y; hold on plot3(x,y,z,k.;maxval,maxind=max(z-(b(1*x

2、+b(2*y; e=abs(maxval+abs(minval; 2.Graph of regressed plant and related points: 3 The numerical value of flatness (The conclusion calculate by matlab, the flatness is 11.5120 m The conclusion with least square method matches the result in jpg (The conclusion calculate with software, which is also 11

3、.5120 m Calculating flatness with Maximum straightness method clear clc A=xlsread(flatness,1;a=;b=;for i=1:size(A,1flag1=1;flag2=1;for j=2:size(A,2-1ifany(isnan(A(i,j=0 & any(isnan(A(i,j-1a=a,j; flag1=0; end if any(isnan(A(i,j=0 & any(isnan(A(i,j+1b=b,j; flag2=0; end end if flag1a=a 1; endif flag2b=

4、b,size(A,2;end endk=;f=;j=1;for i=1:size(A,1 k=k,(A(i,b(j-A(i,a(j/(b(j-a(j; maxval,maxind=max(A(i,a(j:b(j-myfun(a(j:b(j,k(j,b(j,A(i,b(j; minval,minind=min(A(i,a(j:b(j-myfun(a(j:b(j,k(j,b(j,A(i,b(j; f=f,abs(maxval+abs(minval; j=j+1;endf_final=max(f; The conclusion with this method is: (The mallab giv

5、es a result which is 7.215 umCalculating straightness with least square method1. Codeclcclear A=xlsread( e=; for i=1:2:3 a=A(i,:; b=A(i+1,:; d=regress(b,a;figure plot(a,c,r,a,b,b,100,k. .;enda=A(10,1:16;b=A(11,1:16; d=regress(b,a;maxval,maxind=max(b-c; minval,minind=min(b-c; figure plot(a,c,r,a,b,b,

6、100,k. . ; e=e abs(maxval+abs(minval;2. The numerical value of straightnessAccording to Matlab:e =0.0337 0.0312 0.0375 for three lines respectively.3.Theplot of three lines with related zone and curve:(The plot of first line (The plot of second line (The plot of third line II AB Straightness=AB+0=0.

7、0312um II AB Straightness=AB+0=0.0375um IABI BCStraightness=AB+BC=0.0337umCalculate straightness with two end points method1. Codeclearclc A=xlsread(straightness.xls,1; f=;for i=1:2:3 a=A(i,:; b=A(i+1,:; k=(b(1-b(length(b/(a(1-a(length(b; c=k*(a-a(1*ones(1,length(b+b(1*ones(1,length(b; maxval,maxind

8、=max(b-c;minval,minind=min(b-c;figureplot(a,c,r,a,b,b,a(maxind*ones(1,100,linspace(c(maxind,b(maxind,100,k. ,a(minind*ones(1,100,linspace(b(minind,c(minind,100,c. ,a,(k*(a-a(maxind*ones(1,length(b+b(maxind*ones(1,length(b,m. ,a,(k*(a-a(minind*ones(1,length(b+b(minind*ones(1,length(b,y;f=f abs(maxval

9、+abs(minval; enda=A(10,1:16;b=A(11,1:16;k=(b(1-b(length(b/(a(1-a(length(b;c=k*(a-a(1*ones(1,length(b+b(1*ones(1,length(b;maxval,maxind=max(b-c;minval,minind=min(b-c; figure plot(a,c,r,a,b,b,a(maxind*ones(1,100,linspace(c(maxind,b(maxind,100,k. ,a(minind*ones(1,100,linspace(b(minind,c(minind,100,c.,a

10、,(k*(a-a(maxind*ones(1,length(b+b(maxind*ones(1,length(b,m.,a,(k*(a-a(minind*ones(1,length(b+b(minind*ones(1,length(b,y;f=f abs(maxval+abs(minval;2.The numerical value of straightnessAccording to matlab: f =0.0226 0.0287 0.0333 for three lines separately.3.Theplot of three lines with related zone an

11、d curve:Import data from excel, and save it as A Calculate the inclines with two and points. And define lines with then. Finally calculate the vertical intercepts. Plot graph containing all required information. Save the straightness in F Save the straightness in F These process is a repeating of pr

12、eceding steps. ( No need to payattention toIIIIII ABStraightness=AB+0=0.0226um ABABStraightness=AB+0=0.0287umStraightness=AB+0=0.0333umCalculating cylindricity with regressive circle method clc,clear;A=xlsread(cgroup4_1.CSV;B=xlsread(cgroup4_2.CSV;C=xlsread(cgroup4_3.CSV;D=xlsread(cgroup4_4.CSV; n=l

13、ength(X(:,1;y=ones(n,1;b=rand(1*1000 rand(1 rand(1;fun=inline(X(:,1.2+X(:,2.2+a(1*X(:,1+a(2*X(:,2+a(3,a,X;a,r,J = nlinfit(X,y,fun,b ;vpa(a,10 ;X1 =-a(1/2;Y1 =-a(2/2;R =sqrt(a(12+a(22-4*a(3/2;X1=ones(n,1*X1;Y1=ones(n,1*Y1;maxval=max(sqrt(X(:,1-X1.2+(X(:,2-Y1.2;minval=min(sqrt(X(:,1-X1.2+(X(:,2-Y1.2;R

14、1=maxval-minval;The graph of cylinder:Calculating roughness with least squareRead the x,y coordinatefrom excels for differentheight and save then onA,B,C,D respectivelyProject all data to oneplane and regress all datato a specific circle.Find the Radius, centralcoordinates of regressed circle.Find t

15、he difference ofdistance between largestand smallest points fromcentral pointmethod1.Programing code clc;clear; A=xlsread(roughness.xlsx;z=find(isnan(A(:,3; for i=length(z:-1:1 A(z(i,:=;end Z=A(:,3; t=A(:,1,A(:,2,ones(size(A,1,1;b=regress(Z,t; f=abs(b(1*A(:,1+b(2*A(:,2-Z+b(3*ones(size(A,1,1/sqrt(b(1

16、2+b(22+(-12;Ra=mean(f;plot3(A(:,1,A(:,2,Z,k.;hold on X,Y=meshgrid(0:700,0:700; mesh(X,Y,b(1*X+b(2*Y+b(3*ones(size(X,1,size(X,2The conclusion:The Ra found by this method is:Ra= 0.1634 um, which matches the conclusion calculated by software: 3.The graph of regressed plane and measured points: Import the data from

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论