필터 지우기
필터 지우기

Plotting in 3D from a table

조회 수: 41 (최근 30일)
Soumyajit Samal
Soumyajit Samal 2021년 7월 13일
답변: Chunru 2021년 7월 13일
I am given a csv file with 3 columns. The first column is to be the X coordinate, 2nd as Y coordinate and 3rd column as Z coordinate. How can i make a surface plot of this.

답변 (2개)

Siddharth Solanki
Siddharth Solanki 2021년 7월 13일
You may use the readmatrix function for reading from the csv file and refer to this link for creating surface plots. This answer to a similar previous question might help.

Chunru
Chunru 2021년 7월 13일
'doc griddata' for more details.
rng('default')
xy = -2.5 + 5*rand([200 2]);
x = xy(:,1);
y = xy(:,2);
v = x.*exp(-x.^2-y.^2);
% x, y, and v are vectors containing scattered (nonuniform) sample points and data.
% Define a regular grid and interpolate the scattered data over the grid.
[xq,yq] = meshgrid(-2:.2:2, -2:.2:2);
vq = griddata(x,y,v,xq,yq);
% Plot the gridded data as a mesh and the scattered data as dots.
mesh(xq,yq,vq)
hold on
plot3(x,y,v,'o')
xlim([-2.7 2.7])
ylim([-2.7 2.7])

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by