【问题标题】:Plot Lat, Long, and Temperature as a Contour Plot in MATLAB在 MATLAB 中将纬度、经度和温度绘制为等高线图
【发布时间】:2019-01-18 03:09:18
【问题描述】:

我真的停滞不前——认为这很容易。

我有 3 个数组 - 纬度、经度和温度,

我想在每个数据点或位置绘制温度

作为等高线图。

所以(45,123) 的温度是= 73

值示例:

 Latitude = [45 45 67 34 31 54 60 63 61];

 Longitude = [123 121 117 114 132 119 122 135 134];

 Temp = [73 75 75 73 67 72 82 78 80];

【问题讨论】:

    标签: matlab plot contour


    【解决方案1】:

    迟到总比不到好!如果有人正在寻找工作代码应该知道contour 函数有点棘手,您必须使用矩阵来显示等高线图。所以:

    n = length(Latitude);
    [X, Y] = meshgrid(linspace(min(Latitude), max(Latitude), n), linspace(min(Longitude), max(Longitude), n));
    Z = griddata(Latitude, Longitude, Temp, X, Y);
    contour(X, Y, Z);
    

    如果您更喜欢填充地块,请使用:

    contourf(X, Y, Z);
    

    如果你想在worldmap 上绘制你的情节:

    contourfm(X, Y, Z);
    

    希望它对某人有所帮助。

    【讨论】:

    • 非常感谢@Sdghasemi。 6年后我想我的问题永远不会得到回答。
    【解决方案2】:

    有什么困难?只需使用轮廓功能。 http://www.mathworks.com/help/techdoc/ref/contour.html

    contour(Latitude,Longitude,Temp)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-26
      • 1970-01-01
      • 1970-01-01
      • 2016-10-20
      • 2012-04-19
      相关资源
      最近更新 更多