```Path: news.mathworks.com!newsfeed-00.mathworks.com!solaris.cc.vt.edu!news.vt.edu!news.glorb.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!ra8g2000pbc.googlegroups.com!not-for-mail
From: pmassicotte <pmassicotte@hotmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Double integral on vector data
Date: Wed, 23 May 2012 08:49:15 -0700 (PDT)
Lines: 64
NNTP-Posting-Host: 132.209.14.198
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1337788156 937 127.0.0.1 (23 May 2012 15:49:16 GMT)
NNTP-Posting-Date: Wed, 23 May 2012 15:49:16 +0000 (UTC)
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:12.0)
Gecko/20100101 Firefox/12.0,gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:768833

Hi everyone.

I would like to calculate a double integral using trapz function.

You can find the code bellow to reproduce the calculations.

Data:
Ex1 = Excitation data. First column

Step 1: Create the surface from witch I want to calculate the double
integral
Comp1 = Em1(:,2) * Ex1(:,2)';

Step 2: Meshgrid
[X,Y] = meshgrid(Ex1(:,1), Em1(:,1));

Step 3: Integrate
V1 = trapz( Y(:,1), (trapz(X(1,:),Comp1, 2)) )

I would like to know if this make sens.

Regards,
Phil

Em1 =
[244,0;248,0;252,0;256,0;260,0;264,0;268,0;272,0;276,0;280,0;284,0;288,0;292,0;296,0;300,0;304,0.00117994353760033;308,0;312,0;316,0.00240420908782665;320,0.00138043029793836;324,0.00108821898632580;328,0.000973178578386273;332,0.00381920310168305;336,0.00206970068139474;340,0.000726263055750996;344,0;348,0.00440619497062532;352,0.00263929511034441;356,0.00530916712197763;360,0.00323778177948049;364,0.00533450057089101;368,0.00499535891233158;372,0.00748364354674372;376,0.00633673243807795;380,0.00695272009912477;384,0.00811023130712259;388,0.0121070443651793;392,0.00496706228246737;396,0.000804649246720988;400,0;404,0;408,0;412,0;416,0;420,0;424,0;428,0.00289662443098178;432,0.00975971738240084;436,0.0220585085044959;440,0.0373973661840963;444,0.0451210724603598;448,0.0513258948786046;452,0.0610218539291357;456,0.0747374808243804;460,0.0844027131930884;464,0.0996599777063952;468,0.113457953206564;472,0.127702129501913;476,0.140888315164643;480,0.154386487401540;484,0.164896989251204;488,0.176990188063467;492,0.190677448347040;496,0.203425444850348;500,0.199516027374508;504,0.204899414755647;508,0.216890632981524;512,0.212947517130683;516,0.205126813253448;520,0.207071852588759;524,0.204782885339635;528,0.201394624722362;532,0.197354551769844;536,0.194150373737126;540,0.189537547777201;544,0.185948424539187;548,0.179149671502849;552,0.174082671643427;556,0.169636068176487;560,0.165172136249722;564,0.155160370882771;568,0.144795825345041;572,0.141016158312623;576,0.133674012629371;580,0.119808625657233;584,0.115971227342646;588,0.110958610570590;592,0.0978914894170021;596,0.0955872091486208;600,0.0919824585067636;]

Ex1
=[230,0.225145602840502;235,0.238893630451162;240,0.247837201987340;245,0.242505695297467;250,0.214952540096870;255,0.223590371753384;260,0.229991845831113;265,0.226151061479747;270,0.235349767203759;275,0.220152181586335;280,0.215900981868756;285,0.194074169124549;290,0.176842177507824;295,0.170139979307647;300,0.152796070515632;305,0.142711924946759;310,0.134913645785769;315,0.126570045637789;320,0.126181574407151;325,0.127376430330663;330,0.125398399810386;335,0.124978730032115;340,0.123315455620233;345,0.121987342107189;350,0.119192465892409;355,0.115857324421180;360,0.113066298223091;365,0.101222192485231;370,0.102130563513773;375,0.101909076779627;380,0.0949805873829698;385,0.0938850014227109;390,0.0912528977244093;395,0.0847267738381600;400,0.0804693472261893;405,0.0768368844856173;410,0.0715397242542155;415,0.0681008319340599;420,0.0665194220253977;425,0.0620705330313370;430,0.0605468909756114;435,0.0613878328495386;440,0.0609437814584224;445,0.0558328195367593;450,0.0490387182542055;]
```