Info

This question is closed. Reopen it to edit or answer.

How can I draw 3D graph from .xls file?

1 view (last 30 days)
Anh Tuan Bui
Anh Tuan Bui on 3 Sep 2012
Closed: MATLAB Answer Bot on 20 Aug 2021
Hi
I am a new Matlab user (Matlab version R2012a). I have an xls file which contain monthly observation (254 obs from Jul, 1992 to Dec, 2011) of interest rates at different maturities (17 maturities from 3 months to 120 months). Thus I have 18 columns: the first column is the date (monthly) and 17 columns are interest rates.
Could anyone help me to draw 3D graph with x = date column, y = interest rates (value from 3 to 120) is the first row in my .xls file and z = (x,y)
Thank you very much
Best regards,
Anh Tuan

Answers (1)

Oleg Komarov
Oleg Komarov on 3 Sep 2012
  1. Import the files with xlsread()
  2. Then plot the numeric matrix with surf()
  3. [OPTIONAL ] Use datenum() to convert the first column of the imported text cell array into serial dates. Then you can use the serial dates to correctly label one of the axes (the time axis) with set(gca,'Xtick',serialdates) and datetick('x') (I am not sure which is gonna be the time axis, also you might need to invert the axis as well).
Post comments if you get stuck.

Community Treasure Hunt

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

Start Hunting!