3-D Countour Plot based on velocity data
2 次查看(过去 30 天)
显示 更早的评论
I have data consist of X(x coordinate) Y(y coordinate) Z(z coortinate) U(velocity).
there is four z height (0.05,0.18,0.31 and 0.44 )
I tried to create 3D countour plot with given code but it fails.
xyzu = readmatrix('velocity3d.txt');
xyzu = [xyzu(1,:); xyzu];
x=xyzu(:,1);
y=xyzu(:,2);
z=xyzu(:,3);
u=xyzu(:,4);
% [Ux,xix] = unique(x);
% dxix = diff(xix)
Xm = reshape(x, 6, []);
Ym = reshape(y, 6, []);
Zm = reshape(z, 6, []);
Um = reshape(u, 6, []);
figure
contour3(Xm,Ym,Zm,Um)
colormap(turbo)
colorbar
Which code I need to create 3D velocity countour plot? Thank you.
Note: I uploaded my data as an attachment.
0 个评论
采纳的回答
Torsten
2022-12-25
编辑:Torsten
2022-12-25
xyzu = readmatrix('velocity3d.txt');
x=xyzu(:,1);
y=xyzu(:,2);
z=xyzu(:,3);
u=xyzu(:,4);
F = scatteredInterpolant(x,y,z,u);
xq = linspace(min(x),max(x),20);
yq = linspace(min(y),max(y),20);
zq = linspace(min(z),max(z),20);
[xq yq zq] = meshgrid(xq,yq,zq);
uq = F(xq,yq,zq);
xslice = mean(x);
yslice = mean(y);
zslice = mean(z);
slice(xq,yq,zq,uq,xslice,yslice,zslice)
colormap(turbo)
colorbar
7 个评论
Torsten
2022-12-25
编辑:Torsten
2022-12-25
Can you give a link to a plot you are talking about ? The one you posted is a 3d surface plot you can get for each z-value separately, but not for all z-values together.
This is all you can get:
xyzu = readmatrix('velocity3d.txt');
x=xyzu(:,1);
y=xyzu(:,2);
z=xyzu(:,3);
u=xyzu(:,4);
F = scatteredInterpolant(x,y,z,u);
xq = linspace(min(x),max(x),100);
yq = linspace(min(y),max(y),100);
zq = linspace(min(z),max(z),100);
[xq yq zq] = meshgrid(xq,yq,zq);
uq = F(xq,yq,zq);
zslice = [0.05,0.18,0.31,0.44];
h = slice(xq,yq,zq,uq,[],[],zslice);
colormap(turbo)
colorbar
set(h,'EdgeColor','none')
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!