前言:此文为去年我替人做的一个课题,觉得比较简洁,图形也比较美观,因此放在博文里

数据源我放到了百度云盘高脚杯数据源

有兴趣的可以下载数据,跑程序试一下。也可以单独看看代码,看下实现过程。

  • 主函数
% 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
  • 大致结果如下:



最新文章

  1. 解决Linux不能上网ping:unknown host的问题
  2. 示例说明Oracle RMAN两种库增量备份的差别
  3. 类库、委托、is as运算符、泛型集合
  4. 【JS复习笔记】07 复习感想
  5. VS2005内存泄漏检测方法[转载]
  6. jQuery设置checkbox全选(区别jQuery版本)
  7. OPC客户端的进程安全初始化
  8. java笔记2之算术运算符
  9. git 关联远程库(https协议)
  10. 【ASP.NET MVC 学习笔记】- 16 Model Binding(模型绑定)
  11. bootstrap的datepicker在选择日期后调用某个方法
  12. mysql加速source导入数据
  13. [Tensorflow实战Google深度学习框架]笔记4
  14. 用jQuery修改右键菜单
  15. FancyBox的使用技巧 (汇总)
  16. Easyui的datagrid的行编辑器Editor中添加事件(修改某个单元格带出其他单元格的值)
  17. 浅谈getResource方法
  18. 第二个Spring冲刺周期团队进展报告
  19. 用layer插件实现tp3.2的分页
  20. 1.cassandra的搭建

热门文章

  1. web前端基础知识
  2. JavaScript 自定义对象
  3. x:bind不支持样式文件 或 此Xaml文件必须又代码隐藏类才能使用{x:Bind} 解决办法
  4. 基于ASP.NET/C#开发国外支付平台(Paypal)学习心得。
  5. UE4新手引导之下载和安装虚幻4游戏引擎
  6. ThinkPHP 模板substr的截取字符串函数
  7. JavaScript将字符串中的每一个单词的第一个字母变为大写其余均为小写
  8. BPM的魅力何在?
  9. Hadoop的安装与设置(1)
  10. BZOJ 3894: 文理分科 [最小割]