我有一些包含在CSV中的数据,每个数据都包含x y数据。我想在图中叠加这个x,y数据。像等高线图或曲面图或散射3。问题是我正在读取.csv数据并将数据连接到第三维,所以我有一个400x2x30矩阵(行,列,深度)。 col 1是x值温度,col 2是y值密度,z是压力1:30。瀑布会很好,有什么建议吗?
function [ ] = processVLEData( )
fn1 = '/Users/Tricknology/Desktop/FlashDrive/ProgrammingStuff/';
fn2 = 'Thermo/ThermoInOut/Test Data/';
fn3 = '0.5propane0.5methaneT100-500P';
%first run, generate a matrix to concatenate to
formatSpec = '%3.1f\n';
fpath = strcat(fn1,fn2,fn3);
fname = 'TvsPvap.csv';
filename = strcat(fpath,num2str(1.0,formatSpec),'/',fname);
h = figure;
data1 = csvread(filename);
hold on;
axis([120 320 0 1]);
cc=hsv(12);
c = colormap(jet(150));
ylabel(colorbar, 'Pressure (bar)')
for fn4 = 1.0:149.0
fpath = strcat(fn1,fn2,fn3,num2str(fn4,formatSpec),'/');
filename = strcat(fpath,fname);
data2 = csvread(filename);
for i = 100:400
if data2(i,2) == 0
data2(i,2) = NaN;
end
end
data1 = cat(3,data1,data2);
x = data1(:,1);
y = data1(:,2);
z = fn4;
scatter(data2(:,1),data2(:,2),20,c(fn4,:))
xlabel('Temperature (Kelvin)');
ylabel('Liquid Density (g/cm^3)');
title('T vs Liquid Density, (P = 1 to 150bar)');
%concatenate matrix in the third dimension
end
shg
print -dpng 50methane50propaneP100-300P1-150.png
end
基本上我想获取创建此图的数据,并将其作为瀑布图。