MATLAB: Calculate area between y = 0 and the curve plotted by discontinuos data calculate area between y = 0 and the curve ploted by discontinuos data Hi, I have a curve like graph. I want to calculate the area between y = 0 and the curve ploted by discontinuous data. Could you have any suggestions? Best Answer As you have data (x,y) in your hand use trapz(x,y) (Trapezoidal numerical integration) to get the area. doc trapz..Eg:X = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.85];rA = [-.0053, -.0052, -.0050, -.0045, -.0040, -.0033, -.0025, -.0018, -.00125, -.0010];plot(X,-1./rA,'.-r')% Area Int = trapz(X,rA) Related SolutionsMATLAB: Comparing two separate for loops Use intersect():Z =[0.0024 0.0019 0.0015 0.0012 0.0010 0.0007 0.0005 0.0003 0.0002]Y =[0.0031 0.0024 0.0019 0.0015 0.0012 0.0010 0.0007 0.0005 0.0003 0.0002]X = intersect(Z, Y) MATLAB: Plotting discontinuos X Data You can use nan to represent discontinuities:datax = [6 7 8 9 nan 14 nan 48 49 50 55 nan 87 88 89]; datay = [1 1 1 1 nan 2 nan 3 3 3 4 nan 5 5 5];plot(datax,datay,'-o') Related QuestionHow to separate signals with diffrent frequenciesConvert discontinuos angles to continuous angleHow to make a code that will count the number of times the sign changes succesively through an arrayArea under curve (no function)Surf and color bar does not show correct color gradient.Find area of the filled region of a graphHow to normalize curves such that area under curve=1
Best Answer