MATLAB: 3D Plot – term structure

3d plotterm-structure

Hi there,
I am trying to do a figure similar to the one attached.
I have exactly a (224×1) vector with dates (x-axis), a (10×1) vector with maturities (y-axis) and a (224×10) matrix with the values (z-axis).
How can I combine this to make a plot like the one attached?
Thanks, V

Best Answer

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.