Scatter matrix of probability of occurrence
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Vidura Vishvanath
le 13 Avr 2022
Commenté : Vidura Vishvanath
le 13 Avr 2022
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/963275/image.png)
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 commentaires
Réponse acceptée
Simon Chan
le 13 Avr 2022
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
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Scatter Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!