필터 지우기
필터 지우기

How to plot 3 variables (3rd variable on the colorbar)?

조회 수: 21 (최근 30일)
Phoenix
Phoenix 2019년 5월 25일
댓글: Star Strider 2019년 5월 25일
I have three variables (below). I wonder on how will I plot it to achieve something similar with the attached picture?
X = day in a year (1 to 365) --> in days
Y = time in a day (1 up to 24) --> in hours
Z = load data in kW say for example

채택된 답변

Star Strider
Star Strider 2019년 5월 25일
편집: Star Strider 2019년 5월 25일
That looks like a surf plot, using
view(0,90)
to create a 2D plot from it.
How you plot it depends on how your data are organised. The surf function plots a matrix as the third argument, although the first two arguments can be vectors.
EDIT —
Your data are gridded. You can convert them into matrices needed for the surf function using the reshape (link) function, specifically:
D = xlsread('YourFile.xls'); % Use The Appropriate Function To Import Your Data
Xm = reshape(D(:,1), 24, []);
Ym = reshape(D(:,2), 24, []);
Zm = reshape(D(:,3), 24, []);
figure
surf(Xm, Ym, Zm)
view(0,90)
grid on
colorbar
  댓글 수: 4
Phoenix
Phoenix 2019년 5월 25일
It alread worked. Thanks so much.
Star Strider
Star Strider 2019년 5월 25일
As always, my pleasure.

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

추가 답변 (1개)

Image Analyst
Image Analyst 2019년 5월 25일
You can make an image. If you don't have data for every x and y then use scatteredInterpolant. Then use imshow(Z) and colormap(jet(256)); to plot it.
  댓글 수: 1
Phoenix
Phoenix 2019년 5월 25일
Can you tell me how? I have individual data for all those three variables complete for 1 year on a 1 hour timestep. Sample below.
Capture.JPG

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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by