如何使用循环语句求积分上限未知数。
Afficher commentaires plus anciens

目的:通过以上画圈方程,求 I*与b的关系。
f(x)与g(x),分别服从N~(5,0.25),N~(4,0.16)的正态分布。
已将其余的参数赋值,因此自己编写的代码为(代码中I*由t代表):
syms b double
r=1:1:6;
result=zeros(size(r));
for i=1:length(r)
t=r(i);
fun_1= @(x) 0.5.*(x-b).*normpdf(x,5,0.5);
fun_2= @(x) x.*normpdf(x,5,0.5);
fun_3= @(y) y.*normpdf(y,4,0.4);
fun_4= @(x) (b+0.5.*(x-b)).*normpdf(x,5,0.5);
fun_5= @(y) (b+0.4.*(y-b)).*normpdf(y,4,0.4);
fun_6= @(y) 0.6.*(y-b).*normpdf(y,4,0.4);
fun_7=integral(fun_1,b,6.5).*100.*(8-t)./8.*(1-(integral(fun_2,0,b)-integral(fun_3,0,b)+integral(fun_4,b,6.5)-integral(fun_5,b,5.2))./0.5)...
+integral(fun_6,b,5.2).*(100.*(4.5.*(integral(fun_2,0,b)+integral(fun_4,b,6.5))-5.*(integral(fun_3,0,b)+integral(fun_5,b,5.2)))./2.25)...
+12.5.*t.*(1-(integral(fun_2,0,b)-integral(fun_3,0,b)+integral(fun_4,b,6.5)-integral(fun_5,b,5.2))./0.5)-400;
[b,fval] = fzero(fun_7,0.1);
double(b)
end
运行结果:Error using integral (line 85)
A and B must be floating-point scalars.
错误与问题较多,请教高手前辈,十分感谢!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur 编程 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!