필터 지우기
필터 지우기

2D histogram and/or 2D Kernel Density

조회 수: 2 (최근 30일)
Devinya Herath
Devinya Herath 2011년 10월 15일
I have two series of data (of type double). I want to create a 2D histogram plot and a 2D kernel density estimate plot. Please help. Below is my coding
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
curs1 = exec(conn, 'select sp_x, sp_y from road_part6_trajectories_oneway2_new_segments_cartesian2');
format long;
curs1 = fetch(curs1);
AA = curs1.Data;
x = [AA{:,1}]';
y = [AA{:,2}]';
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Pls let me know how to create a 2D histogram from x and y (both of type double)

채택된 답변

Wayne King
Wayne King 2011년 10월 15일
Are you sure you don't mean you want a 3-d histogram of a bivariate random variable, x and y? A histogram of one random variable is a 2-D histogram.
See hist3
load carbig
X = [MPG,Weight];
hist3(X,[7 7]);
xlabel('MPG'); ylabel('Weight');
set(gcf,'renderer','opengl');
set(get(gca,'child'),'FaceColor','interp','CDataMode',...
'auto');
  댓글 수: 1
Devinya Herath
Devinya Herath 2011년 10월 15일
of course you are correct. I got the thing done by using hist3. By the way do you have any idea of generating the kernel density?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by