锐单电子商城 , 一站式电子元器件采购平台!
  • 电话:400-990-0325

Matlab 高脚杯模型切片

时间:2022-08-30 12:00:00 高脚led双脚连接器

如果您感兴趣,可以下载数据并尝试运行程序。您也可以单独查看代码和实现过程。主函数%xls_data=xlsread('data_more.xls');

%x=xls_data(1:3:end);

%y=xls_data(2:3:end 1);

%data=[x,y];

%save('data.mat','data');

clc,clear

loaddata.mat

x=data(:,2);

y=data(:,1);

yy=smooth(y);

figure

plot(yy,x,'.r');

axisequal

gridon

title('origdata');

%%拟合

%xx=[min(x):0.1:max(x)]';

%fitsize=4;%拟合次数自己定义

%p=polyfit(x,y,fitsize);

%f=polyval(p,xx);

%figure

%plot(f,xx,'linewidth',2);

%axisequal

%gridon

%title('fitdata')

%%

figure

[X,Y,Z]=cylinder(yy(end:-1:1));

[m,n]=size(X);

color=ones(m,n);

h=surf(X,Y,Z);

alpha(0.8)%设置透明度

CM=[1,0,1];

CM=repmat(CM,32,1);

colormap(CM);

lightinggouraud;camlight;shadinginterp

title('themodel')

%%

%figure

%pcolor(X,Y,Z);shadinginterp%伪彩×××

%figure

%contourf(X,Y,Z)%等高线图

%view(3)

%figure,surf(X,Y,Z)%三维曲面

%%曲线个数为20slice图

figure

plot_hor(X,Y,Z,1,10,518,'m');

gridon

plot_hor(X,Y,Z,100,5,400,'m');

title('slice')

%%骨架图virticalandhorizontal

figure

plot3(X,Y,Z,'linewidth',2,'color','b')

holdon

plot_hor(X,Y,Z,1,5,518,'b');

gridon

title('framework用于绘制高脚杯骨架的调用函数functionplot_hor(x,y,z,First1,Step1,End1,color)

fori=First1:Step1:End1

x_hor=x(i,1:21);y_hor=y(i,1:21);z_hor=z(i,1:21);

plot3(x_hor,y_hor,z_hor,'linewidth',2,'color',color);

holdon

end

end一般结果如下:

173912dd8bd9091db4f8f0f4cf0af26e.png

锐单商城拥有海量元器件数据手册IC替代型号,打造电子元器件IC百科大全!

相关文章