plot the original "price1” %and "price2” and the “interpolated price1” against the index and label the lines with a legend of 'p1', 'p2', 'p1-g'. in matlab

Assuming price1 is stored in the vector p1, price2 is stored in the vector p2, interpolated price1 is stored in the vector pg, and index is stored in the vector ind, the following code can be used to plot and label the lines:

main.m
plot(ind, p1, ind, p2, ind, pg)
legend('p1', 'p2', 'p1-g')
59 chars
3 lines

This will plot each vector against the index and label the lines with the legend specified.

related categories

gistlibby LogSnag