Scatter matrix of probability of occurrence
9 次查看(过去 30 天)
显示 更早的评论
Hii
I have a set of data corresponding to two Variables Hs and Tp and I need to generate a scatter matrix with probablities of occurence as given in the figure below.
I was able to split Hs values into intervals using 'discretize' and seperate corrosponding Tp values using,
%% SCATTER PLOT
clc; clear all; close all;
Hs = table2array(readtable('Wave.xlsx','Range','A2:A5849'));
Tp = table2array(readtable('Wave.xlsx','Range','B2:B5849'));
edges = 0:0.5:4;
limit = length(edges)-1;
binindices = discretize(Hs,edges);
splitHs = arrayfun(@(bin) Hs(binindices == bin), 1:limit, 'UniformOutput', false);
splitTp = arrayfun(@(bin) Tp(binindices == bin), 1:limit, 'UniformOutput', false);
celldisp(splitHs);
However im having a hard time figuring out a way to build the matrix. any help would be appreciated.
Data is attached. Thank you!
0 个评论
采纳的回答
Simon Chan
2022-4-13
You may use function hiscounts2
rawdata = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/963270/Wave%20data_Galle_NARA.xlsx');
Hs_edges = 0:0.5:6;
Tp_edges = 4:1:22;
[N,Xedges,Yedges,binX,binY] = histcounts2(rawdata(:,2),rawdata(:,1),Tp_edges,Hs_edges,'Normalization','probability');
N
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Scatter Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!