Time plot

OpenSource For You - - LET’S TRY -

Some­times, it’s nec­es­sary to ob­serve how a pa­ram­e­ter varies over time. The plot has the pa­ram­e­ter on the y axis and the time on the x axis. In this ex­am­ple, the data is or­gan­ised in four col­umns: year, month, day and price of the diesel fuel. The func­tion datenum is first used to con­vert the orig­i­nal data (the first three col­umns) to the x co­or­di­nates and then the func­tion dat­evec is used to cre­ate the la­bels on the x axis. Last, a ‘fast’ cu­bic spline is used for con­nect­ing the points.

If you are in need of a plot type that’s not avail­able in Scilab, by de­fault, you can write it with some lines of code. The code nec­es­sary for the cal­cu­la­tions is rel­a­tively short and most of it (and per­haps, the most bor­ing part) is ded­i­cated to

Newspapers in English

Newspapers from India

© PressReader. All rights reserved.