Matlab 根据轮廓线获取高脚杯模型
2016-12-17 18:33
405 查看
前言:此文为去年我替人做的一个课题,觉得比较简洁,图形也比较美观,因此放在博文里
数据源我放到了百度云盘高脚杯数据源有兴趣的可以下载数据,跑程序试一下。也可以单独看看代码,看下实现过程。
主函数
% 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 load data.mat x=data(:,2); y=data(:,1); yy=smooth(y); figure plot(yy,x,'.r'); axis equal grid on title('orig data'); %% 拟合 % xx=[min(x):0.1:max(x)]'; % fitsize=4;%拟合次数自己定义 % p=polyfit(x,y,fitsize); % f=polyval(p,xx); % figure % plot(f,xx,'linewidth',2); % axis equal % grid on % title('fit data') %% 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); lighting gouraud;camlight;shading interp title('the model') %% % figure % pcolor(X,Y,Z);shading interp%伪彩色图 % figure % contourf(X,Y,Z) %等高线图 % view(3) % figure,surf(X,Y,Z)%三维曲面 %% 曲线个数为20 slice图 figure plot_hor(X,Y,Z,1,10,518,'m'); grid on plot_hor(X,Y,Z,100,5,400,'m'); title('slice') %% 骨架图 virtical and horizontal figure plot3(X,Y,Z,'linewidth',2,'color','b') hold on plot_hor(X,Y,Z,1,5,518,'b'); grid on title('framework');
被调用函数,用于绘制高脚杯骨架
function plot_hor(x,y,z,First1,Step1,End1,color) for i=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); hold on end end
大致结果如下:
相关文章推荐
- Matlab 高斯_拉普拉斯滤波器处理医学图像
- 利用matlab将自己的数据制作为标准VOC数据集格式
- matlab 工具函数 —— logdet(A)
- 【Matlab】把一年中的某一天(从1月1日起)换算成日期
- matlab---逐步回归
- Matlab 绘制三维立体图(以地质异常体为例)
- 关于labview调用MATLAB脚本节点报1046错误的解决办法。
- MATLAB双目标定步骤
- Matlab 利用参数方程绘制空心球体
- Matlab 数据处理总结
- 【学习笔记】Get Started with MATLAB-Chapter04
- matlab
- matlab-双目标定及场景重建
- Matlab标定
- Matlab绘图设置
- matlab中的乘除法
- [置顶] SLIC超像素分割slicmex源代码在windows下matlab中mex出错的修正
- 机器学习笔记----Fuzzy c-means(FCM)模糊聚类详解及matlab实现
- Matlab风格的Plot类 for OpenCV
- Matlab中画参数方程图像