Definite integral with parameter

조회 수: 10 (최근 30일)
Edoardo Marelli
Edoardo Marelli 2022년 2월 2일
댓글: Alan Stevens 2022년 2월 2일
Hi, I have the following equation to integrate:
c = (5.*x.^2-Fa.*x)./(((a.*x+q).*W-((a.*x+q)-2.*t).*(W-2.*t)).*(0.5.*(a.*x+q)-0.5.*q)+(W.*(a.*x+q).^3)./12-((W-2.*t).*(a.*x+q-2.*t).^3)./12);
I need to integrate in terms of x and I don't know the value of Fa (but it is a real value). I tried using int or integral alone or combined with vpa but Matlab gives as a result the same equation without integrating. I tried integrating it as a function but still no luck.
The integration is between 0 and 2300 and the parameters are:
a = 0.043478;
q = 100; % Ha
W = 40;
t = 4;

채택된 답변

Alan Stevens
Alan Stevens 2022년 2월 2일
You could try something like this:
a = 0.043478;
q = 100; % Ha
W = 40;
t = 4;
c = @(x,Fa )(5.*x.^2-Fa.*x)./(((a.*x+q).*W-((a.*x+q)-2.*t).*(W-2.*t)).*(0.5.*(a.*x+q)-0.5.*q)...
+(W.*(a.*x+q).^3)./12-((W-2.*t).*(a.*x+q-2.*t).^3)./12) - Fa; % Subtract Fa for use in integral
lo = 0; hi = 2300;
Fa = 1; % Set rhe value of Fa when you know it
Q = integral(@(x)c(x,Fa),lo,hi);
disp(Q)
1.6580e+03
  댓글 수: 2
Edoardo Marelli
Edoardo Marelli 2022년 2월 2일
Thank you for your answer, I just realised I didn't explain it well.
I need to find Fa equating the integral to 0. So I would need to integrate first, and then equate the integrated function to 0 to get the Fa.
Alan Stevens
Alan Stevens 2022년 2월 2일
Like this then
a = 0.043478;
q = 100; % Ha
W = 40;
t = 4;
c = @(x,Fa )(5.*x.^2-Fa.*x)./(((a.*x+q).*W-((a.*x+q)-2.*t).*(W-2.*t)).*(0.5.*(a.*x+q)-0.5.*q)...
+(W.*(a.*x+q).^3)./12-((W-2.*t).*(a.*x+q-2.*t).^3)./12) - Fa; % Subtract Fa for use in integral
lo = 0; hi = 2300;
Q = @(Fa) integral(@(x)c(x,Fa),lo,hi);
Fa0 = 1; % Initial guess
Fa = fzero(Q,Fa0);
disp(Fa)
1.7207

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by