将matlab图转换为gnuplot 3d

时间:2013-04-11 16:31:10

标签: matlab 3d gnuplot translate

随着时间的推移,我有一个fft数据矩阵,8192行数据x 600列时间。第一列是频率标签,第一行如下所示,但实际上并不存在于数据文件中,空格也没有,只是为了便于阅读而显示。

Frequency, Sec1, Sec2, Sec3...Sec600
1e8,       -95,  -90,  -92
1.1e8,    -100, -101, -103
...

使用以下代码在matlab中绘制 (对其他海报的道歉,我抓错了matlab代码)

x是8192行乘600列的矩阵,f是频率标签数组,FrameLength = 1,figN = 3

function [] = TimeFreq(x,f,FrameLength,figN)


 [t,fftSize] = size(x);
 t = (1:1:t) * FrameLength;

figure(figN);
mesh(f,t,x)
xlabel('Frequency, Hz')
ylabel('time, sec')
zlabel('Power, dBm')
title('Time-Freq Representation')

我无法弄清楚如何让它在gnuplot中运行。以下是Matlab中的示例图像:http://imagebin.org/253633

2 个答案:

答案 0 :(得分:0)

要在gnuplot中完成此工作,您需要查看splot(用于“曲面图”)命令。你可以通过在终端中运行以下命令来解决很多问题:

$ gnuplot
gnuplot> help splot

具体来说,您想要阅读运行所显示的帮助页面(在上面提示请求子主题之后):datafile。这应该足以让你开始。

此外,this question的答案可能会有所帮助。

答案 1 :(得分:0)

所以这是我最终使用的gnuplot命令脚本。它有一些额外的元素,不在原始的matlab图中,但所有的基本要素都在那里。

set term png size 1900,1080
set datafile separator ","
set pm3d

# reverse our records so that time moves away from our perspective of the chart
set xrange[*:*] reverse

# hide parts of the chart that would make the 3d view look funny
set hidden3d

# slightly roate our perspective and compress the z axis
set view 45,75,,0.85

set palette defined (-120 "yellow", -70 "red", -30 "blue")
set grid x y z
set xlabel "time (secs)"
set ylabel "frequency"
set zlabel "dBm"

# plot all the data
set output waterfall.png
splot 'waterfall.csv' nonuniform matrix using 1:2:3 with pm3d lc palette