Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


dpb
Posts:
8,161
Registered:
6/7/07


Re: calculate the area of a curve
Posted:
Mar 23, 2013 2:22 PM


On 3/23/2013 1:02 PM, angelina wrote: > "Nasser M. Abbasi" wrote in message <kikco2$ops$1@speranza.aioe.org>... >> On 3/23/2013 7:57 AM, angelina wrote: >> > Hi! >> > I am not sure if there is a way to calculate the area of a curve in >> matlab. >> >> curve does not have an area. it is just a curved line. it has a length >> though >> and it has curvature, but area? >> >> >What I want to do , is first , define the curve (which is a load >> duration >> >curve) and it is three piece linear.How can I define it? >> > The coordinates are (0,100) , (2.8,75) and (100,25) >> > Then , I want for the beginning to calculate the whole area af >> >the curve and after that for many straight lines of the form y=a I want >> >to calculate the area of the two areas that are created. >> > Any comment or help woould be of great importance! >> > Thanks a lot! >> > >> >> >> It sounds like you want to integrate a function and you have >> only 3 points for it? May be you can look at trapz. >> >> http://www.mathworks.com/help/matlab/ref/trapz.html >> >> "Z = trapz(Y) computes an approximation of the integral of Y via the >> trapezoidal method" >> >> good luck, >> >> Nasser >> > > Hi Nasser! > Thanks for your reply! > It seems that I didn't explain correctly. > > What I want to do is this: > I have that: > > X=[0 ; 0.028; 1;]; > Y=[1; 0.75; 0.25;]; > plot(X,Y); > So if you plot this thing imagine that I want to find the area between > the line and the axes x and y.After that for any line of the form y=g I > want to find again the area between the line y=g y=ax+, my initial line > and the axes x and y . > Thank you! I hope now I explained welll! > I am waiting for any reply! > Angelina
Well, for the line segments the area is analytically computable but trapz() will work. Simply subtract the area of the lower curve(s) from the upper.




