Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

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

1 vue (au cours des 30 derniers jours)
Anh Tuan Bui
Anh Tuan Bui le 3 Sep 2012
Clôturé : MATLAB Answer Bot le 20 Août 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

Réponses (1)

Oleg Komarov
Oleg Komarov le 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.

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by