MATLAB: Printing the average line on a graph

averagegraph line averageMATLAB

load site.dat;
plot(site(:,13),(site(:,9)));
xlabel({'Time','(In Minutes)'})
ylabel('Water Vapor Concentration')
title('Water Vapor Concentration vs Time');
Screen Shot 2019-09-29 at 9.44.47 PM.png
This is the graph i get which is the one I need but now just need to figure out how to print the average of the water vapor concentration on the graph.

Best Answer

  • yline(mean(site(:,9)),'b-','Mean concentration') %r2018b or later
    plot([min(xlim()),max(xlim())],mean(site(:,9))*[1,1]) % any matlab release