フィルターのクリア

Normalized Wind Rose Plot help

12 ビュー (過去 30 日間)
Douglas Leaffer
Douglas Leaffer 2023 年 6 月 22 日
コメント済み: Star Strider 2023 年 12 月 22 日
I am trying to generate a normalized (to the max) wind rose plot of air pollutant concentration (UFP) by wind direction. See photo below. A data vector is attached. The simple code: polarplot(N.WD_Deg,N.UFPConc) doesn't generate what I want. Any help is appreciated. Thank you
load winddata.mat
polarplot(N.WD_Deg,N.UFPConc)
  4 件のコメント
Douglas Leaffer
Douglas Leaffer 2023 年 6 月 24 日
移動済み: VBBV 2023 年 6 月 25 日
Thank you VBBV and Star Strider. Both of your suggested codes worked for me - but I can't seem to rotate the compass points to have 0 at the top and then clockwise ticks, with 90 deg at right, 180 at bottom and 270 at left. Is there a simple programmatic fix for this?
E. Cheynet
E. Cheynet 2023 年 6 月 25 日
For the direction with meteorological conventions, you can simply give a new direction newD = 90-oldD

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

採用された回答

Star Strider
Star Strider 2023 年 6 月 23 日
Perhaps something like this —
LD = load('winddata.mat');
N = LD.N;
N.WD_Rad = deg2rad(N.WD_Deg) % Add Radian Variable (For Convenience, Since 'polarplot' Requires It)
N = 133872×4 table
WD_Deg WS UFPConc WD_Rad ______ ______ _______ ______ 30 25.927 0.11886 0.5236 30 25.927 0.13314 0.5236 30 25.927 0.16629 0.5236 30 25.927 0.15657 0.5236 30 25.927 0.15257 0.5236 30 25.927 0.15486 0.5236 30 25.927 0.12457 0.5236 30 25.927 0.12457 0.5236 30 25.927 0.15829 0.5236 30 25.927 0.13657 0.5236 30 25.927 0.124 0.5236 30 25.927 0.108 0.5236 30 25.927 0.10343 0.5236 30 25.927 0.12914 0.5236 30 25.927 0.18229 0.5236 30 25.927 0.19371 0.5236
[UDir,ix,iv] = unique(N.WD_Rad); % Unique Radian Values & Indices (Sorted)
Concv = accumarray(iv, (1:numel(iv)).', [], @(x)numel(N.UFPConc(x))); % Accumulate Count Values Of 'UFPConc' By Direction (Use 'numel' To Count Occurrences)
[sDir, sConc] = stairs(UDir, Concv); % Return 'stairs' Stepwise Result
figure
polarplot(sDir, sConc) % Plot 'stairs' Stepwise Result
figure
polarplot(UDir, Concv) % Plot Continuous Result
figure
polarhistogram(N.WD_Rad, UDir) % Plot Using 'polarhistogram'
Make appropriate changes to get the result you want.
Using the accumarray function, it is possible to get other parameters of the concentration, such as the mean or median values, as well as standard deviations (std and metrics derived from it, such as confidence intervals) and plot them also using the patch function (although that is more complicated and requires calculating them in polar coordinates and then using the pol2cart function first, and plotting them in Cartesian coordinates), not only the counts.
.
  4 件のコメント
Douglas Leaffer
Douglas Leaffer 2023 年 6 月 24 日
Excellent. It worked fine. Thank you
Star Strider
Star Strider 2023 年 6 月 24 日
As always, my pleasure!

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

その他の回答 (1 件)

Douglas Leaffer
Douglas Leaffer 2023 年 12 月 22 日
Hello, it seems the plots generated from these suggested answers are not what I need. I need a normalized [0 1] wind rose of UFP (air pollution particle) by wind degree sector, as show in these 3 examples. My dataset is attached. The code I ran is given below. I could use some more help if anyone is able. Thank you.
load CR_1hr_wind.mat
NC = normalize(CT1,"norm",Inf,"DataVariables","UFPConc");
NC.WD_Rad = deg2rad(NC.WD_Deg) % Add Radian Variable (For Convenience, Since 'polarplot' Requires It)
[UDir,ix,iv] = unique(NC.WD_Rad); % Unique Radian Values & Indices (Sorted)
Concv = accumarray(iv, (1:numel(iv)).', [], @(x)numel(NC.UFPConc(x))); % Accumulate Count Values Of 'UFPConc' By Direction (Use 'numel' To Count Occurrences)
%[sDir, sConc] = stairs(UDir, Concv); % Return 'stairs' Stepwise Result
%figure
%polarplot(sDir, sConc)
figure
%subplot (121)
polarplot(UDir, Concv, 'LineWidth', 4) % Plot Continuous Result
Ax = gca;
Ax.ThetaZeroLocation = 'top';
Ax.ThetaDir = 'clockwise';
  3 件のコメント
Douglas Leaffer
Douglas Leaffer 2023 年 12 月 22 日
That seems to be more of what I need. Thanks again
Star Strider
Star Strider 2023 年 12 月 22 日
As always, my pleasure!

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

カテゴリ

Help Center および File ExchangePolar Plots についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by