I am new to Matlab and I think this is a very basic question..
I have two arrays:
tst
ans =
0 0 0.2500 0.2500 0 0 0 0
prp
ans =
0 0 0 0.5333 0.0333 0.0333 0.1667 0.0667
I want to plot the averages between those two on the same plot (as a line). What is the best way to do it?
I usually do something like:
And repeat for
prp. You can style the lines however you want according to the linespec documentation.Note that you should do this at the end of anything that would change the xlimits (
holding and plotting something else, etc.) as it depends onxlim().Edit
I may have misunderstood your question. The above code will plot a horizontal line at the average of the points in the array
tst.If instead you want a line plot whose points are the average of the two arrays, you want something like: