3D-Surface from .dat-File

4 次查看(过去 30 天)
Trier87
Trier87 2012-12-15
回答: ebot joel 2018-6-1
Hello, i have a test.dat File with a Variable Buff that has 3 columns. The Code for this looks like this:
Buff = zeros(numel(850:10:870)*numel(1286:10:1306),3);
Ctr = 1;
for EG = 1286:10:1306
for PC=850:10:870
Main
Buff(Ctr, 1) = PC;
Buff(Ctr, 2) = EG;
Buff(Ctr, 3) = XXX;
Ctr = Ctr+1;
end
end
save test.dat Buff;
The Output looks like this:
Column1 Column2 Column3
(Iteration PC=850:10:870 ) (Iteration EG=1286:10:1306) (XXX)
850 1286 ...
860 1286 ...
870 1286 ...
--- --- ---
850 1296 ...
860 1296 ...
870 1296 ...
--- --- ---
850 1306 ...
860 1306 ...
870 1306 ...
Now i want make a 3D-plot Surface of this data/values. How i can load the values of the columns from test.dat into a plot and the next question is: Must i use the command meshgrid or is this possible with interpolation between the serveral points.
Thank you!

回答(1 个)

ebot joel
ebot joel 2018-6-1
M=dlmread('test.dat')
plot3(M(:,1.),M(:,2),M(:,3))

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by