필터 지우기
필터 지우기

3D Plot - term structure

조회 수: 1 (최근 30일)
V
V 2015년 4월 27일
편집: Youssef Khmou 2015년 4월 27일
Hi there,
I am trying to do a figure similar to the one attached.
I have exactly a (224x1) vector with dates (x-axis), a (10x1) vector with maturities (y-axis) and a (224x10) matrix with the values (z-axis).
How can I combine this to make a plot like the one attached?
Thanks, V

채택된 답변

pfb
pfb 2015년 4월 27일
That is a mesh plot.
% here I'm making up data with the same sizes as yours
dates = 1:224;
maturities = (1:10)';
values=rand(224,10);
% here I'm plotting the mesh plot. Of course you'll use your data
mesh(maturities,dates,values);
% if you need to swap the axes then go
mesh(dates,maturities,values');
You can consider using the surf function instead of mesh. Another option is waterfall. Type "help mesh" (and in general "help function") to get the documentation.
  댓글 수: 2
pfb
pfb 2015년 4월 27일
oh, I forget the axes labels. You get those as follows
xlabel('maturities');
ylabel('dates');
zlabel('values');
Of course you have to set xlabel and ylabel according to the order you chose.
Youssef  Khmou
Youssef Khmou 2015년 4월 27일
편집: Youssef Khmou 2015년 4월 27일
the third option is using surfc function which is the same as surf plus a contour plot in the z=0 plane.

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

추가 답변 (0개)

카테고리

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