matrix form numerical integration
Show older comments
This code does not work
clear;
x = [1.0024 0.264 1.4334 1.46 0.0219 0.1;
1.0024 0.264 1.435 1.46 0.0220 0.1;
1.0024 0.264 1.4352 1.46 0.0221 0.1;
1.0024 0.264 1.4353 1.46 0.0222 0.1;
1.0024 0.264 1.4354 1.46 0.0222 0.1;
1.0024 0.264 1.4357 1.46 0.0223 0.1];
r = x(:,1); Y = x(:,2); q = x(:,3); K=x(:,4); L=x(:,5); c=x(:,6);
t = 0.1:0.1:0.6;
z = trapz(t,normcdf(((log(q./K)+t.*c.^2./2)./(c.*sqrt(t))),0,1));
If I just use one line of records, i.e
z = trapz(t,normcdf(((log(q(1)./K(1))+t.*c(1).^2./2)./(c(1).*sqrt(t))),0,1));
Then it works!!! What I dont understand is how to do this 'trapz' for each line of records in the vector 'x'.
Accepted Answer
More Answers (0)
Categories
Find more on Numerical Integration and Differentiation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!