matlab离散点网格图绘制
有限元方法里得到n个离散点每个坐标对应不同的数值解现在想把这些个数据绘制成三维网格图请各位高手给出代码谢谢各个点坐标(2,0,12.00000),(3,0,20.2199...
有限元方法里得到n个离散点 每个坐标对应不同的数值解 现在想把这些个数据绘制成三维网格图 请各位高手给出代码 谢谢
各个点坐标(2,0,12.00000), (3,0,20.219911), (4,0,28.000000),
(1,1.732051,4.000000),(1.5,2.598076,3.719906), (2,3.464102,0.000001),
(-1,1.732051,0.000000 ),(-1.5,2.598076,-2.280095), (-2,3.464102,-8.000001 ),
(-2,0,-8.000001,4.000000), (-3,0, 0.000000 ,8.219906), (-4,0,12.000000),
( -1,-1.732051,0.000000) , (-1.5,-2.598076,-2.280094), (-2,-3.464101, -7.999999),
(1,-1.732051,3.999999), (1.5,-2.598076,3.719909) , (2,-3.464102,-0.000003) 展开
各个点坐标(2,0,12.00000), (3,0,20.219911), (4,0,28.000000),
(1,1.732051,4.000000),(1.5,2.598076,3.719906), (2,3.464102,0.000001),
(-1,1.732051,0.000000 ),(-1.5,2.598076,-2.280095), (-2,3.464102,-8.000001 ),
(-2,0,-8.000001,4.000000), (-3,0, 0.000000 ,8.219906), (-4,0,12.000000),
( -1,-1.732051,0.000000) , (-1.5,-2.598076,-2.280094), (-2,-3.464101, -7.999999),
(1,-1.732051,3.999999), (1.5,-2.598076,3.719909) , (2,-3.464102,-0.000003) 展开
3个回答
展开全部
x=[2,3,4,1,1.5,2,-1,-1.5,-2,-1,-3,-4,-1,-1.5,-2,1,1.5,2];
y=[0,0,0,1.732051,2.598076,3.464102,1.732051,2.598076,3.464102,-8,0,0,-1.732051,-2.598076,-3.464101,-1.732051,-2.598076,-3.464102];
z=[12,20.219911,28,4,3.719906,0.000001,0,-2.280095,-8.000001,4,8.219906,12,0,-2.280094,-7.999999,3.999999,3.719909,-0.000003];
plot3(x,y,z,'-o');
grid on
就可以滴啦。
y=[0,0,0,1.732051,2.598076,3.464102,1.732051,2.598076,3.464102,-8,0,0,-1.732051,-2.598076,-3.464101,-1.732051,-2.598076,-3.464102];
z=[12,20.219911,28,4,3.719906,0.000001,0,-2.280095,-8.000001,4,8.219906,12,0,-2.280094,-7.999999,3.999999,3.719909,-0.000003];
plot3(x,y,z,'-o');
grid on
就可以滴啦。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
本视频展示如何用matlab绘制散圆状态图,可用于相关科研数据绘图!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐于2016-06-20 · 知道合伙人教育行家
关注
展开全部
meshgrid用于从数组a和b产生网格。生成的网格矩阵A和B大小是相同的。它也可以是更高维的。
[A,B]=Meshgrid(a,b)
生成size(b)Xsize(a)大小的矩阵A和B。它相当于a从一行重复增加到size(b)行,把b转置成一列再重复增加到size(a)列。因此命令等效于:
A=ones(size(b))*a;
B=b'*ones(size(a))
例1:
>> a=[1:2]
a =
1 2
>> b=[3:5]
b =
3 4 5
>> [A,B]=meshgrid(a,b)
A =
1 2
1 2
1 2
B =
3 3
4 4
5 5
>> [B,A]=meshgrid(b,a)
B =
3 4 5
3 4 5
A =
1 1 1
2 2 2
例2:
[X,Y] = meshgrid(-2:.2:2, -2:.2:2);%-2到2之间有4/0.2+1=21个值,所以X、Y都是21*21大小的矩阵
Z = X .* exp(-X.^2 - Y.^2);
surf(X,Y,Z)%见图1
mesh(X,Y,Z)%见图2
mesh(Z)%见图3
%mesh命令用来生成由X,Y,Z定义的网线图,生成规则如下:
(1)X,Y分别为维数是m,n的向量,且(n,m)= size(Z),则生成网线的交叉点为(X(j),Y(i),Z(i,j));
(2)X,Y分别为矩阵,则生成网线的交叉点为(X(i,j),Y(i,j),Z(i,j))。
网线图的颜色由Z定义,即网线曲面的高度和颜色成比例。
[A,B]=Meshgrid(a,b)
生成size(b)Xsize(a)大小的矩阵A和B。它相当于a从一行重复增加到size(b)行,把b转置成一列再重复增加到size(a)列。因此命令等效于:
A=ones(size(b))*a;
B=b'*ones(size(a))
例1:
>> a=[1:2]
a =
1 2
>> b=[3:5]
b =
3 4 5
>> [A,B]=meshgrid(a,b)
A =
1 2
1 2
1 2
B =
3 3
4 4
5 5
>> [B,A]=meshgrid(b,a)
B =
3 4 5
3 4 5
A =
1 1 1
2 2 2
例2:
[X,Y] = meshgrid(-2:.2:2, -2:.2:2);%-2到2之间有4/0.2+1=21个值,所以X、Y都是21*21大小的矩阵
Z = X .* exp(-X.^2 - Y.^2);
surf(X,Y,Z)%见图1
mesh(X,Y,Z)%见图2
mesh(Z)%见图3
%mesh命令用来生成由X,Y,Z定义的网线图,生成规则如下:
(1)X,Y分别为维数是m,n的向量,且(n,m)= size(Z),则生成网线的交叉点为(X(j),Y(i),Z(i,j));
(2)X,Y分别为矩阵,则生成网线的交叉点为(X(i,j),Y(i,j),Z(i,j))。
网线图的颜色由Z定义,即网线曲面的高度和颜色成比例。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询