Complex Integration in MATLAB with symbolic integration limits

I'm having trouble with integrating this using MATLAB. When i try and run it as shown below, the answer that comes out i'm pretty sure is wrong. This is the first time i'm using matlab to help with integration so apologies in advance if i'm doing something very silly. Can anyone give me some pointers as to what i'm doing wrong?
syms y b n_1 n_2 R
b_y = (b-((b-(b/4))/(n_1+n_2))*y);
x = (y^2*b_y)/(1+(y/R));
I = int(x,-n_1,n_2)
I = 

5 commentaires

Any assumptions on the parameters n_1, n_2, b or R that could help simplifying the result ?
Hello, So R, n_1, and n_2 will be constants i believe, and b is also a fixed value (its the max value of b(y) when y is at n_1)
Any assumptions on the parameters n_1, n_2, b or R that could help simplifying the result ?
E.g. is -R in the interval of integration (thus in the interval [-eta1 eta2]) so that your function would have a pole ? Are eta1 and eta2 positive ? Are all parameters involved real numbers or can they be complex ?
What do you mean by "is -R in the interval of integration"? - Really sorry, i'm not familiar with that term. But eta1 and eta2 are both positive values and all parameters involved are real numbers. Appreciate your time helping! :)
What do you mean by "is -R in the interval of integration"?
If -R is in the interval [-eta1 eta2], the denominator of your integrand becomes 0 and your integrand +/- Infinity or NaN.
Similar to
syms x
f = 1/(1-x);
int(f,x,0.5,1.5)
ans = 
NaN

Connectez-vous pour commenter.

 Réponse acceptée

Torsten
Torsten le 25 Juin 2024
Modifié(e) : Torsten le 25 Juin 2024
Does this help ?
Note that no distiction is made about the R-value. But you should keep in mind that the answer is incorrect if -R is in the interval [-eta1 eta2].
syms y b n_1 n_2 R
b_y = (b-((b-(b/4))/(n_1+n_2))*y);
x = (y^2*b_y)/(1+(y/R));
I = int(x,y);
simplify(subs(I,y,n_2)-subs(I,y,-n_1))
ans = 

3 commentaires

Elliott Kitson
Elliott Kitson le 25 Juin 2024
Déplacé(e) : Torsten le 25 Juin 2024
From looking into it, if I’m not mistaken R only causes an issue if it is equal to or less than eta_1, which in this situation, would never be the case. R is always greater than eta_1.Does this then mean that the solution you provided below would be valid?
Does this then mean that the solution you provided below would be valid?
Yes.
Thanks for the help! Massively appreciate it :)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Function Creation dans Centre d'aide et File Exchange

Produits

Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by