Defining a symbolic function with an integral
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi all,
I'm trying to define a symbolic function to represent the continuous time Fourier transform given by,

with the following code:
syms f;
CFTx(f) = int(x(t)*exp(-1i*2*pi*f*t), t, -Inf, Inf);
However, when I attempt to evaluate CFTx(s) at a some point s, say s = 10 the following is returned (directly from my command window):
CFTx(10)
ans =
int(exp(-pi*t*20i)*(5*cos(15*pi*t) + 2*sin(12*pi*t) + 5*exp(-(t - 25)^2/2)), t, -Inf, Inf)
I have tried evaluating this expression using the subs() function but so far have not had any luck.
Any advice is much appreciated.
0 comentarios
Respuestas (1)
Star Strider
el 31 de Mzo. de 2017
Your approach is correct, Your implementation needs to substitute the limits of integration with symbolic variables you can then substitute later.
Example —
syms f t T
x(t) = (5*cos(15*pi*t) + 2*sin(12*pi*t) + 5*exp(-(t - 25)^2/2));
CFTx(f) = int(x(t)*exp(-1i*2*pi*f*t), t, -T, T);
CFTx(f,T) = simplify(CFTx, 'Steps',20)
Then substitute for appropriate values of ‘f’ and ‘T’.
2 comentarios
David Beallor
el 31 de Mzo. de 2017
Editada: David Beallor
el 31 de Mzo. de 2017
Star Strider
el 31 de Mzo. de 2017
My pleasure!
Most likely, you cannot have infinite limits, especially with a time-domain function that is periodic and may have an arbitrary value at ±Inf. I would choose a finite value for ‘T’, and then choose a frequency for the evaluation. Note that ‘pure’ periodic functions ‘exist’ in the Fourier transform only at the individual frequencies at which they are defined. They do not exist elsewhere.
I would do this:
a = simplify(subs(CFTy(s,T), [s], [10]), 'Steps',20)
and then substitute a finite value of ‘T’.
If you want to get the Fourier transform with infinite limits, use the Symbolic Math Toolbox fourier function:
Y(w) = fourier(y, t, w);
Y(w) = simplify(Y, 'Steps',20)
Y(w) =
5*pi*(dirac(w - 15*pi) + dirac(w + 15*pi)) - pi*(dirac(w - 12*pi) - dirac(w + 12*pi))*2i + 5*2^(1/2)*pi^(1/2)*exp(- (w + 25i)^2/2 - 625/2)
The dirac functions are due to the periodic functions existing only at those frequencies.
Plot or evaluate ‘Y(w)’ at the values of ‘w’ (‘omega’ or 2*pi*f) you want.
Ver también
Categorías
Más información sobre Linear Algebra en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!