a data set in Matlab?I have a data set that I need to graph and then find the area under the curve.
2/12/2007 9:28:25 PM
i just looked under the help, searcher "integrate data"
2/12/2007 9:35:04 PM
well shit, i keep getting an error when i try to run matlab through putty and I need this before I can finish my lab report that is due tomorrow [Edited on February 12, 2007 at 9:59 PM. Reason : ]
2/12/2007 9:49:24 PM
might need a trip to broughton tonight if its just plotting the data and getting the area, send me the data and your code to plot/calculate it, and i'll run it and paste it in word and send it back. rstruzik@gmail.com
2/12/2007 10:02:12 PM
Matlab typically runs through GUI, so it won't work directly on Putty. If you run XWin with Putty, Matlab will usually be fine.
2/12/2007 10:05:47 PM
I think you might be right about that trip to broughton . . . although i'm not sure what time those labs close nowI would take you up on your offer, but I don't even have that code in front of me.^I am running X-win32 and Putty. It says "Fatal Java Exception Detected"[Edited on February 12, 2007 at 10:08 PM. Reason : ]
2/12/2007 10:06:37 PM
^ that shit always lagged like hell for me, if you're close enough it's easier to just go to campusedit:i think broughton closes at 11dh hill is open 24hrs mon-thursor laundry labs should be open all night i think[Edited on February 12, 2007 at 10:12 PM. Reason : times]
2/12/2007 10:09:52 PM
newton's method.
2/12/2007 10:16:23 PM
Daniels had the 24hr engineering computer lab last i checked, though that was a year ago[Edited on February 12, 2007 at 10:18 PM. Reason : on the 1st or 2nd floor]
2/12/2007 10:18:02 PM
You could always just use excel to plot the data and use Simpson's rule for the area unless you have a lot of data points.
2/12/2007 10:21:20 PM
^I have 12 data points . . . what is simpson's rule again?
2/12/2007 10:34:22 PM
%Define the function to integrate (using anonymous functions)f = @(x) x^2;%Set the interval to integratea = -1;b = 1;%set the number of panels to compute and their lengthn = 100;h = (b-a)/n;%split up the interval into subintervalsx = [a:h:b];%note that matlab matrices are indexed starting at 1sum = f(x(1));for i=2:2:n sum = sum + 4*f(x(i));end;for i=3:2:n-1 sum = sum + 2*f(x(i));end;%prints out the resultf_integrated = (h/3)*(sum + f(x(n+1)))
2/12/2007 10:37:32 PM
yeah, I remembered Simpsons rule shortly after I posted that I just did it in excel real quick . . . not hte most accurate, but it'll do for now /thread[Edited on February 12, 2007 at 10:43 PM. Reason : thx everyone]
2/12/2007 10:42:44 PM
um...if you have a discrete set of points, you don't really integrate that. the discrete version of an integral is just a summation. like deltax*sumofdata. if you have an explicit that you want matlab to numerically integrate, than you define the function either as an m file or as an anonymous function and then use the quad command:help quadwhich uses i think gaussian quadratures to evaluate. simpsons rule uses parabolic quads. anyways..have fun.
2/13/2007 4:32:06 PM