matlab利用已知数据画图三维,请教大佬,已知数据存入Excel中,用matlab怎么画出三维图??...

clear all

clc

dat=[     0       40     44        50      40      40     42     40     40        42       40      40       40

1       40     42        43      44      40     40      40    40        41       41       42      40

2       41     42        40      40      40      41     42    40        40       40       40      40

3       42    40        40       40      40      40     40     40       40        40       40      40

4       40     40       40       40      40     40      40     40       40       40       40      40

5      41      42       42       43       41     41      42     41       40       40      40      40

6      40      40       40       40       40      40     40     40       40       40      40      40

7      41      42       43       41       42      40      40    40        40       40      40      40

8      40      45      45        41       40      40      40    40        40        40      40      40

9      41      42       41       42        41     42      40     40       40        40       40      40

10      42      42       40       40        40      40      50      40      45       40       40       40];

hei=dat(:,1);

R_mat= dat(:,2:end);

n_lay=length(hei);

n_len= length(R_mat(1,:));

the = pi/6*[1:n_len];

col_mm=jet(n_lay);

hold on

for i=1:n_lay

z=hei(i);

for j = 1 :n_len;

r=R_mat(i,j);

the = pi/6 * (j-1) ;

x = r*cos(the);

y = r*sin(the);

X(i,j)=x;

Y(i,j)=y;

Z(i,j)=z;

plot3([0 x],[0 y],[z z],'-','linewidth',2+0.1*i,'color',col_mm(i,:));

end

end

X=[X';X(:,1)']';

Y=[Y';Y(:,1)']';

Z=[Z';Z(:,1)']';

h_su=surf(X,Y,Z)

alpha(h_su,0.2)

pbaspect([1 1 2])

box on

view(-5,12)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值