필터 지우기
필터 지우기

how can wirte this integration in matlab.

조회 수: 1 (최근 30일)
Pawan Kumar
Pawan Kumar 2018년 6월 4일
댓글: Walter Roberson 2018년 6월 5일
file is attached
  댓글 수: 2
Walter Roberson
Walter Roberson 2018년 6월 5일
The solution depends upon the relationship between k and q, and can be further resolved by adding assumptions. Some of the solutions are infinite.
I was certain I had already posted this information.
Walter Roberson
Walter Roberson 2018년 6월 5일
I was right, I did post it. You asked the question in a different topic as well.. leading to duplicated effort. :(
The solution depends on whether k is positive, 0, or negative, and on the relative values of qs and 2*k . In some combinations of circumstances it is undefined. MATLAB is able to resolve some of the combinations if you add appropriate assumptions to the variables, but it is not able to tell you the full conditional resolution under other assumptions.

댓글을 달려면 로그인하십시오.

답변 (2개)

Paridhi Yadav
Paridhi Yadav 2018년 6월 4일
fun = @(q) q^4/(2*pi*(k^3)*((q + qs)^2)*sqrt(1-(q/2*k)^2));
jdp(k) = integral(fun,0,2*k);

Ameer Hamza
Ameer Hamza 2018년 6월 4일
If you try to find a closed-form solution, then MATLAB is unable to solve for it for the given integral,
syms k q qs
integrand = 1/(2*pi*k^3*(q+qs)^2*sqrt(1-(q/(2*k))^2))*q^4;
J = int(integrand, q, 0, 2*k)
J =
int(q^4/(2*k^3*pi*(q + qs)^2*(1 - q^2/(4*k^2))^(1/2)), q, 0, 2*k)
The result is same as the input statement. But if you try to solve it numerically then you can do it as follow
integrand = @(q,qs,k) 1./(2*pi.*k.^3.*(q+qs).^2.*sqrt(1-(q./(2*k)).^2)).*q.^4;
J = @(k, qs) integral(@(q) integrand(q, qs, k), 0, 2*k);
qs = 1;
k = 10;
J(k, qs)
ans =
0.8855
  댓글 수: 1
Pawan Kumar
Pawan Kumar 2018년 6월 5일
from 1st ans i got result like 1*1 sym and from 2nd is same as code replicate

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by