Definite integral with parameter

10 visualizzazioni (ultimi 30 giorni)
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;

Risposta accettata

Alan Stevens
Alan Stevens il 2 Feb 2022
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 Commenti
Edoardo Marelli
Edoardo Marelli il 2 Feb 2022
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 il 2 Feb 2022
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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Programming in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by