Scatter matrix of probability of occurrence
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Vidura Vishvanath
am 13 Apr. 2022
Kommentiert: Vidura Vishvanath
am 13 Apr. 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.
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 Kommentare
Akzeptierte Antwort
Simon Chan
am 13 Apr. 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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Scatter Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!