如何使用MATLAB中坐标给出的值制作热图? [英] How to make a heat map with values given by coordinates in MATLAB?

查看:1160
本文介绍了如何使用MATLAB中坐标给出的值制作热图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个10018x3矩阵,其中每一行代表在特定(x, y)坐标处的测量值.也就是说,第一列包含所有x值,第二列包含所有y值,第三列包含所有测量值.

I have a 10018x3 matrix, where each row represents a measurement at a particular (x, y) coordinate. That is, the 1st column contains all the x values, the 2nd has all the y values, and the 3rd contains all the measurements.

该矩阵在此处可用.

我现在希望绘制出测量值的热图.我该怎么办?

I now wish to plot the heat map of the measurements. How should I do that?

尽管可能很愚蠢,但我还是尝试做scatter3(x, y, z),这使我感到很困惑.

My attempt, although maybe stupid, is to do scatter3(x, y, z), which renders me this

尽管我可以看到趋势,但我希望的是这一趋势.

Although I can see the trend, yet what I am wishing for is this.

推荐答案

您还可以使用TriScatteredInterp进行插值并创建等高线图:

You can also interpolate using TriScatteredInterp and create a contour plot:

x=linspace(min(data(:,1)),max(data(:,1)),150);
y=linspace(min(data(:,2)),max(data(:,2)),150);
[X,Y]=meshgrid(x,y);
F=TriScatteredInterp(data(:,1),data(:,2),data(:,3)-1);
contourf(X,Y,F(X,Y),100,'LineColor','none')

这篇关于如何使用MATLAB中坐标给出的值制作热图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆