在R ^ 3中给出30分。我们如何用三个连续闭合曲面近似给定点(x,y,z)?请注意,三个不同的"级别"或"表面"像
(1)蛋黄的蛋黄;
(2)蛋的白色;
(3)shell。
表面彼此包围,不相交 通过运行下面的代码,您将看到红色,黑色和蓝色3D图形的框架。这三个框架应该近似我的三个曲面。我们怎么做?请帮忙!提前感谢您的任何尝试!
clear all
clc
%level 1, the smallest, inside all; "north" and "south" points are in the process
x_527=[-2.5 -2.625 -2.6]
y_527=[0.0135 0.0145 0.0145]
z_527=[6.8168 6.8168 6.8168]
%level 2, in the middle, 3D, "north" and "south" points are PRESENT
x_615=[-2.32 -2.5 -2.54 -2.7 -2.9 -2.51 -2.67 -2.6125 -2.2 -2.5 -2.9 ]
y_615=[0.0122 0.014 0.0145 0.016 0.02 0.0145 0.0145 0.014 0.0115 0.0145 0.02 ]
z_615=[6.8168 6.8168 6.8168 6.8168 6.8168 6.7 6.8168 6.8168 6.8168 7 6.8168 ]
%level 3, the biggest; flat, "north" and "south" points are in the process
x_756=[-1.5 -2.4 -2.7 -2.756 -3.407 -3.652 -2.683 -1.5 -2.5 -3.652 -2.5 -1.5]
y_756=[0.006 0.0115 0.014 0.0145 0.02 0.022 0.02 0.006 0.0145 0.022 0.0145 0.006]
z_756=[6.8168 6.8168 6.8168 6.8168 6.8168 6.8168 6.8168 6.8168 8.7 6.8168 5.15 6.8168]
plot3(x_527,y_527,z_527,'rx',x_527,y_527,z_527,'red',x_615,y_615,z_615,'blacks',x_615,y_615,z_615,'black',x_756,y_756,z_756,'bo',x_756,y_756,z_756,'blue','MarkerSize',7,'LineWidth',2);
%drawing three levels one inside another using source (x,y,z) data
grid on;
title('Error function F(alpha)','FontSize',15,'fontname','times')
xlabel('Parameter alpha_{0}','FontSize',14,'fontname','times')
ylabel('Parameter alpha_{1}','FontSize',14,'fontname','times')
zlabel('Parameter alpha_{2}','FontSize',14,'fontname','times')
hleg1 = legend('Errors q-ty: 5.27%','','Errors q-ty: 6.15%','','Errors q-ty: 7.56%','');
这将产生这个情节:
答案 0 :(得分:2)
仍然不确定你想要什么,但我想你想绘制每个级别的凸包(2D):
clear all
clc
x = [-2.5 -2.625 -2.6 -2.32 -2.5 -2.54 -2.7 -2.9 -2.51 -2.67 -2.6125 -2.2 -2.5 -2.9 -1.5 -2.4 -2.7 -2.756 -3.407 -3.652 -2.683 -1.5];
y = [0.0135 0.0145 0.0145 0.0122 0.014 0.0145 0.016 0.02 0.0145 0.0145 0.014 0.0115 0.0145 0.02 0.006 0.0115 0.014 0.0145 0.02 0.022 0.02 0.006];
z = [5.27 5.27 5.27 6.15 6.15 6.15 6.15 6.15 6.15 6.15 6.15 6.15 6.15 6.15 7.56 7.56 7.56 7.56 7.56 7.56 7.56 7.56];
% Surface level 1
x1=x(1:3);
y1=y(1:3);
z1=z(1:3);
% Surface level 2
x2=x(4:14);
y2=y(4:14);
z2=z(4:14);
% Surface level 3
x3=x(15:22);
y3=y(15:22);
z3=z(15:22);
% Determine convexhull indices
K1 = convhull(x1,y1);
K2 = convhull(x2,y2);
K3 = convhull(x3,y3);
% Plot convex hulls
figure()
hold on
fill3(x1(K1),y1(K1),z1(K1),[1 0 0])
fill3(x2(K2),y2(K2),z2(K2),[0 1 0])
fill3(x3(K3),y3(K3),z3(K3),[0 0 1])
在绘制旋转图形视图后,看看这是否是你想要的。
祝你好运!