Info

此问题已关闭。 请重新打开它进行编辑或回答。

Can someone please tell me where I'm wrong so that I can correct it

1 次查看(过去 30 天)
M = 2.5
fun1 = @(y) 1./y.*((sqrt(M^2 - 1)- cot(x)));
Km = integral(fun1,0,2.5);
above is my code an I need to know how to use the integral function on it. I keep getting this set of errors
Error in Intergral_test>@(y)1./y.*((sqrt(M^2-1)-cot(x)))
Error in integralCalc/iterateScalarValued (line 314)
fx = FUN(t);
Error in integralCalc/vadapt (line 132)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 75)
[q,errbnd] = vadapt(@AtoBInvTransform,interval);
Error in integral (line 88)
Q = integralCalc(fun,a,b,opstruct);
Error in Intergral_test (line 3)
Km = integral(fun1,0,2.5); %returns C-.

回答(1 个)

John D'Errico
John D'Errico 2017-6-10
编辑:John D'Errico 2017-6-10
You don't think having
- cot(x)));
in an integral with a kernel that is a function of y will cause a problem? :)
If x is symbolic, know that integral CANNOT solve a symbolic problem. If x is something else, I would point out that you have not defined it, in what you have shown us.
  4 个评论
Manil Athapattu
Manil Athapattu 2017-6-10
编辑:Manil Athapattu 2017-6-10
thanks a lot mate figured it out, my bad did not think that it would go to infinity at 0, either way i used 0.000001 which is pretty small. plus that constant i get is going to be used in some other equations so that is makes sense.
John D'Errico
John D'Errico 2017-6-10
But 0.0000001, or whatever will create a arbitrarily large result and very different, based on whether you decided to use 0.0001, 0.0000000001, whatever. So just using a small number is not the right way to solve this, since exactly what number you choose as "small" will give you absurdly different results.
The .png suggests this is something that lives along some path. What path, we don't know, since we have been given only one single expression from a book or paper.

此问题已关闭。

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by