Borrar filtros
Borrar filtros

i want to plot line grahp of the following data pls help

2 visualizaciones (últimos 30 días)
x=[July'15 Aug'15 Sept'15 Oct'15 Nov'15 Dec'15 Jan'16 Feb'16 Mar'16 April'16 May'16] y=[5.7 7.2 7.8 6.8 7.5 7.8 8.0 7.6 8.8 6.3 6.0]; z=[6.5 7.7 8.5 8.8 9.0 12 12 11.9 10.8 7.1 8.3]; w=[6.5 7.7 8.7 8.2 8.3 10.2 11.5 11.7 9.5 6.5 7.0]; v=[6.2 7.3 8.2 8.2 8.5 9.3 10.9 11.7 10.0 6.6 6.4]; plot (x,y,'r-',x,z,'b-',x,w,'k-',x,v,'m-') xlabel 'TX POWER' ylabel 'Eb/No(dB) Levels' title 'Eb/No Level at Selected Radio Nigeria FM stations accross Nigeria' grid on legend('Suprime FM','Coal City FM','Metro FM','Premier FM')

Respuesta aceptada

Star Strider
Star Strider el 21 de Jun. de 2016
You first have to convert your dates to date numbers (using the datenum function). Then use that as your x-coordinate (independent variable) in your plot, and use the datetick function to format the date numbers as date strings.
This should get you started:
x = {'July 15'; 'Aug 15'; 'Sept 15'; 'Oct 15'; 'Nov 15'; 'Dec 15'; 'Jan 16'; 'Feb 16'; 'Mar 16'; 'April 16'; 'May 16'};
xdn = datenum(x); % Use This For ‘x’
xds = datestr(xdn, 'mmm yy') % Check Conversion (Not Necessary For Code)
I had to convert your dates to a cell array of strings. See: Cell Arrays for details. See the documentation for times and dates as well.
I leave the rest to you.

Más respuestas (0)

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by