| Thread Closed |
Matlab Numerical Integration - Syntax/Style Query |
Share Thread | Thread Tools |
| Dec4-09, 05:40 AM | #1 |
|
|
Matlab Numerical Integration - Syntax/Style Query
Hi,
Pretext: I have no formal background in matlab or maths in general, so apologies if any of the following doesn't make sense. I am also new to this forum, so apologies if this post is incorrect in any way. [n.b. I also posted this thread on mathhelpforum.com] Context: Ok, so I wanted to find the response value for various parameter values, using the following equation: [If you can't see the image, it is an integration with infinite bounds over an equation consisting of a Gaussian probability density function multiplied by the the square of a Gaussian cumulative density function plus one minus the square of another Gaussian cumulative density function] I wasn't sure whether it was possible to do this using the matlab symbolic toolkit (syms), so I thought I'd take a crack at it using numerical integration, using the quad command. After much effort and confusion, I ended up with the following code. Code:
mu=0;
sigma=1;
s=0;
alpha=0.4;
mu=sprintf('%f', mu);
sigma=sprintf('%f', sigma);
s=sprintf('%f', s);
alpha=sprintf('%f', alpha);
f=strcat('normpdf(x+',s,',',mu,',sqrt(2)*',sigma,').*(normcdf(x,',mu,',sqrt(2)*',alpha,'*',sigma,').^2 + (1 - normcdf(x,',mu,',sqrt(2)*',alpha,'*',sigma,')).^2)');
quad(f,-1000,1000)
Many thanks for your time, Best, pete |
| PhysOrg.com |
science news on PhysOrg.com >> Hong Kong launches first electric taxis >> Morocco to harness the wind in energy hunt >> Galaxy's Ring of Fire |
| Thread Closed |
| Tags |
| integration, matlab |
| Thread Tools | |
Similar Threads for: Matlab Numerical Integration - Syntax/Style Query
|
||||
| Thread | Forum | Replies | ||
| numerical integration in matlab | General Math | 0 | ||
| Numerical Integration in MATLAB | Math & Science Software | 0 | ||
| Matlab Numerical Integration | Math & Science Software | 3 | ||
| Need Help with Numerical Integration in MATLAB | Calculus | 0 | ||
| Matlab - Numerical Integration | Math & Science Software | 4 | ||