Scatter matrix of probability of occurrence
22 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Vidura Vishvanath
el 13 de Abr. de 2022
Comentada: Vidura Vishvanath
el 13 de Abr. de 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 comentarios
Respuesta aceptada
Simon Chan
el 13 de Abr. de 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
Más respuestas (0)
Ver también
Categorías
Más información sobre Scatter Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!