MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

### Discover what MATLAB® can do for your career.

 Subject: Double integration From: bob bobby Date: 27 Apr, 2011 21:17:05 Message: 1 of 4 hi all! I've been struggling to figure out how to calculate this double integral using matlab for the last few days and I'm totally stuck. I've read a wide variety of posts about double integrations and quad2d and dblquad but I'm no closer to figuring this out. I'm trying to integrate the following equation (safe link on imageshack): http://img844.imageshack.us/i/codecogseqn3.gif/ where s and x are random variables and f(x) and g(s) are the respective pdfs. I have tried to use the following quad2d(@(x,s) normpdf(s).*normpdf(x).*(s+x-1), @(s) 1-s, 500, -500, 500); but I get this error message: ??? Error using ==> quad2d at 97 A must be a finite, scalar, floating point constant. which makes sense sure, and I tried switching round the s and the x the limits but I am getting weird results and I am pretty certain it's totally wrong to do this. I think I need to use a loop to compute the 1-s prior to the integration but I am totally lost. I would really appreciate some help here, many thanks. Regards, Robert