Help with Numerical integration (convert symbolic expression to double)

1 次查看(过去 30 天)
Hello MATLAB community
I am trying to solve the folowing integral
Here is my code
However MATLAB throws an error
Error using integralCalc/finalInputChecks (line 511)
Input function must return 'double' or 'single' values. Found
'sym'.
N=10;
S=[20 25 18 29 17 28 23 20 21 30];
normA = S - min(S(:));
normA = normA ./ max(normA(:));
A=normA;
A(5)=0.1;
syms k x
p=subs(k.^(x-1),k,[A(1:N)]);
L=(prod(p));
fun3=@(x)x.^(N-1).*[L];
q2=(integral(fun3,0,inf));
  3 个评论
AAQIB PEERZADA
AAQIB PEERZADA 2020-6-3
I didn't see your response when I was updating my question. It could be because I didn't referesh the webpage. Thanks for your help though.

请先登录,再进行评论。

采纳的回答

madhan ravi
madhan ravi 2020-6-3
N=10;
S=[20 25 18 29 17 28 23 20 21 30];
normA = S - min(S(:));
normA = normA ./ max(normA(:));
A=normA;
A(5)=0.1;
syms k x
p=subs(k.^(x-1),k,A(1:N));
L=prod(p);
fun3=matlabFunction(x.^(N-1).*L);
q2=integral(fun3,0,inf,'arrayvalued',1)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Assumptions 的更多信息

产品


版本

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by