Calculating area under graph from results of a for loop
Im currently designing a shock absorber for an aircraft undercarriage, i have input all the relevant information and formulas into Matlab and created an M file with a functioning for loop giving a graph. The problem i'm having now is that in order to work out the area under the graph that i get from the file i need a line of best fit, which cannot be plotted in matlab on a for loop with the use of hold on and hold off. The code i wrote is at the bottom of this post
Is it possible to either put the results of the for loop into a vector to plot or failing that another way to get matlab to calculate the area under each graph.
The code i have created is below:
Thanks any suggestions or pointers would be greatly appreciated