Definite integral with parameter
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Edoardo Marelli
le 2 Fév 2022
Commenté : Alan Stevens
le 2 Fév 2022
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;
0 commentaires
Réponse acceptée
Alan Stevens
le 2 Fév 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)
2 commentaires
Alan Stevens
le 2 Fév 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)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur MATLAB Coder dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!