Integrating a function with nested functions

6 vues (au cours des 30 derniers jours)
TheBestTreeInTheForest
TheBestTreeInTheForest le 21 Avr 2015
Hello all,
I have been stuck on a problem where I had written a function and integrated it in regards to 1 variable and it worked fine. I then adjusted it to become a function of 2 variables and changed to a double integral. However, this isn't working properly.
The original function was:
*function s_avg=siev_avg(rs,Mw,Jv)
rp=0;
fun1=@(rp)sieving(rs,rp,Mw,Jv).*log_normal(rp).*rp.^4;
fun2=@(rp)log_normal(rp).*rp.^4;
s_avg =integral(fun1,1.03*rs,inf)/integral(fun2,0,inf);
end*
I then changed it to this:
*function Sa=actual(rs,Mw)
b=0.03648*10^9;
fun1=@(r,rp)sieving3(rs,rp,Mw,r).*log_normal(rp).*rp.^4;
fun2=@(rp)log_normal(rp).*rp.^4;
Sa =integral2(fun1,0,b,1.03*rs,inf)./integral(fun2,0,inf);
end*
And the result was that instead of the integration running on the nested function I simply get the result from before multiplied by "b" which is the maximum value of "r".
How can I get this to run the integral on the innermost function because there is basically only one function nested 3 or 4 layers deep that is actually a function of "r".
Any input would be appreciated.
Thanks.

Réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by