Effacer les filtres
Effacer les filtres

Basic Integration from negative infinity to a variable

13 vues (au cours des 30 derniers jours)
H.W
H.W le 29 Mai 2020
Hello all!
I have just started using MATLAB, so do bear with me.
I'm trying to intergerate the following function: exp(-x)*cos(2*pi*t) from negative infinity to t
So what I will is first declare the functionas fun1: fun1 = @(x)exp(-x)*cos(2*pi*t)
After which, I should do this: syms t (not sure what this does too, can anyone explain?)
Then I will do this where r is my output: r = integral (fun1,-Inf,t)
However it givees me an error: Error using integral (line 85)
A and B must be floating-point scalars.
Not sure what I did wrong, can anyone help? Thanks :)
  1 commentaire
David Goodmanson
David Goodmanson le 29 Mai 2020
Hi HW
Before you get to the code, I'm assuming you do mean exp(-x)*cos(2*pi*t) rather than exp(-x)*cos(2*pi*x). Then cos(2*pi*t) can be factored out of the integral since it's independent of x. That leaves the integral of exp(-x) from -infinity to t. But that integral is infinite, because the argument of the exponent is increasing as x --> -infinity.

Connectez-vous pour commenter.

Réponses (1)

Surya Talluri
Surya Talluri le 11 Août 2020
I understand that your lower limit is -Inf, it makes e^(-x) tends to Inf.
In MATLAB, you can create symbolic math variables using “syms” function and use “int” function to integrate the symbolic functions created.
syms t
fun1 = @(x)exp(-x)*cos(2*pi*t);
r = int(fun1,-Inf,t)
r =
Inf*(2*cos(pi*t)^2 - 1)
You can refer to following documentation for further understanding of Symbolic Math Toolbox:

Catégories

En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by