Trying to solve a definite integral but wont give numerical solution
1 次查看(过去 30 天)
显示 更早的评论
- Q=150;
- k=1.49;
- n=0.02;
- So=0.0048;
- b=3;
- g=32.2;
- x1=0;
- y1=3; %x2=200;
- h=20;
- x2=200;
- syms y;
- f_xy=(So-((Q*n)/(k*b*(y^(5/3))))^2)/(1-((Q^2)/((b^2)*g*y^3)));
- func=int(f_xy,y,[x1 x2]);
- vfunc=vpa(func);
- y=y1+vfunc;
- ys=string(y);
- yf=str2double(ys);
this is what shows up in the varaibles for ys= "int((10000/(22201*y^(10/3)) - 3/625)/(12500/(161*y^3) - 1), y, 0, 200) + 3"
Also the above equation is not how it should look with variables plugged in.
0 个评论
采纳的回答
Torsten
2019-8-23
Q=150;
k=1.49;
n=0.02;
So=0.0048;
b=3;
g=32.2;
x1=0;
y1=3; %x2=200;
h=20;
x2=200;
f_xy=@(y)(So-((Q*n)./(k*b*(y.^(5/3)))).^2)./(1-((Q^2)./((b^2)*g*y.^3)));
vfunc=integral(f_xy,x1,x2);
y=y1+vfunc
7 个评论
Torsten
2019-8-23
编辑:Torsten
2019-8-23
Q=150;
k=1.49;
n=0.02;
So=0.0048;
b=3;
g=32.2;
x1=0;
y1=3; %x2=200;
h=20;
x2=[20,40,60];
f_xy=@(y)(So-((Q*n)./(k*b*(y.^(5/3)))).^2)./(1-((Q^2)./((b^2)*g*y.^3)));
vfunc = zeros(numel(x2,1));
for i=1:numel(x2)
vfunc(i) = integral(f_xy,x1,x2(i));
end
y = y1+vfunc
But - as already said - you should check whether the integral exists at all.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!