Area between line and curve (no function)
<p>I want to calculate the area beween the orange and the blue line. I managed to shade the area. But I do not know how to apply the <code>trapz</code> function in order to get the area. In this post: <a href="https://stackoverflow.com/questions/38409981">Area under surface between two curves</a> I got some solutions but I do not have a specific equation for the curves just the plots per se.</p>

<p>The code for the orange line is:</p>

<pre><code>x_1 = [0,M1_1];
y_1 = [c1,c1];
v = plot(x_1,y_1,'LineWidth',2)
</code></pre>

<p>The blue curve is a plot of arrays with the length of (10000x1)-abscissa and (1x10000)-ordinate.</p>

<p>If I use</p>

<pre><code>%c0_1: Intersection blue curve with y-axis
%c1_1: Intersection orange curve with y-axis
A = trapz(ab1(0:c1_1),ab_y1(c1_1:c0_1))
</code></pre>

<p>I get the following error:</p>

<blockquote>
  <p>Warning: Integer operands are required for colon operator when used as
  index  Warning: Integer operands are required for colon operator when
  used as index  Error using trapz (line 58) LENGTH(X) must equal the
  length of Y in dim 2.</p>
</blockquote>

<p>How can I apply my <code>trapz</code> function easily on my problem?</p>

<p><a href="https://i.stack.imgur.com/NwYyd.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NwYyd.jpg" alt="enter image description here"></a></p>