Filter löschen
Filter löschen

3D-Surface from .dat-File

4 Ansichten (letzte 30 Tage)
Trier87
Trier87 am 15 Dez. 2012
Beantwortet: ebot joel am 1 Jun. 2018
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!

Antworten (1)

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

Community Treasure Hunt

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

Start Hunting!

Translated by