フィルターのクリア

convert orderd vector into a matrix

1 回表示 (過去 30 日間)
giacomo labbri
giacomo labbri 2021 年 1 月 13 日
編集済み: Matt J 2021 年 1 月 17 日
Hello everyone,
I am trying to understand how to convert ordered vector into a matrix. Here is my problem:
lat=[4,7,4,8,3,5]
lon=[32,31,32,33,35,38]
wind_speed=[12,24,45,56,78,24]
The correspoding values are identified by their position in the vector. This is to say that at the location lat(1)=4 e lon(1)=32 there was a wind speed of wind_speed(1)=12.
What I would like to have is two vector of lat and lon with unique and ordered values and a 2D matrix of wind values. My aim is to plot it with the function contour as
contour(X,Y,win_spd)
where X and Y are the new vector of ordered and unique lon and lat values and win_spd is a matrix with the the dimesion of X by Y.
Any help is greatly appricieted!
Giacomo
  5 件のコメント
giacomo labbri
giacomo labbri 2021 年 1 月 15 日
編集済み: giacomo labbri 2021 年 1 月 15 日
thanks a lot! just out of curiosity what if I had no NaN?
Btw I would like to accept your answer but it seems I cannot because you posted it as a comment. If you put it in the aswer section I will accept it!
Stephen23
Stephen23 2021 年 1 月 17 日
編集済み: Stephen23 2021 年 1 月 17 日
"just out of curiosity what if I had no NaN?"
The issue is not the NaN per se, but what kind of interpolation depends on if the input data are gridded or scattered:
There are many ways that scattered data could be stored: in vectors, in a matrix (with NaN values), etc.
Gridded data cannot contain NaN values.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by