How do you do a sine transform in Matlab?

32 visualizzazioni (ultimi 30 giorni)
L'O.G. il 19 Dic 2022
Commentato: Paul il 20 Dic 2022
The sine transform is defined as
How do you do a sine transform and its inverse? The functions dst and idst are not recommended for some reason.

Risposta accettata

Star Strider
Star Strider il 19 Dic 2022
In general, a Fourier transform is defined as:
and its inverse:
since apparently ξ is in Hz (or at least not already in radian measure). (The negative sign can be applied either to the forward or inverse transform, so long as the convention is maintained between them.)
So the inverse transform would likely be the negative of the original transform. There are several ways to calculate the integral, among them int and integral. (I doubt that trapz or cumtrapz would be appropriate here, however I am listing it to be complete.)
  2 Commenti
L'O.G. il 19 Dic 2022
Thanks, since frequency is defined within the function that you wish to take the sine transform of (in the equation I posted), how do you use the integral function in that case?
Star Strider
Star Strider il 19 Dic 2022
The integral produces a result that is a function of frequency, so define the frequency to define the funciton at that frequency —
syms f(t) xi
f(t) = 1/2;
F(xi) = int(f*exp(1j*xi*t), t, -Inf, Inf)
F(xi) = 
F(xi) = int(f*exp(1j*xi*t), t, -1, 1) % A More Tractible Expression
F(xi) = 
F = simplify(F, 500)
F(xi) = 
[n,d] = numden(F) % Calcuate Derivatives
n(xi) = 
d(xi) = 
dn = diff(n)
dn(xi) = 
dd = diff(d)
dd(xi) = 
fplot(F, [-1 1]*15)
title('Transform plotted as a function of frequency')
The result in this instance is a sinc function. Not all functions will have analytic integrals, so in that event, it would be necessary to do numerical integration. (The value of this function at the origin is , however by L'Hospital’s rule, is , so finite.)

Accedi per commentare.

Più risposte (2)

Bora Eryilmaz
Bora Eryilmaz il 19 Dic 2022
Modificato: Bora Eryilmaz il 19 Dic 2022
According to Wikipedia, versions of it can be computed using the discrete cosine transform: "A DST-III or DST-IV can be computed from a DCT-III or DCT-IV (see discrete cosine transform), respectively, by reversing the order of the inputs and flipping the sign of every other output, and vice versa for DST-II from DCT-II. In this way it follows that types II–IV of the DST require exactly the same number of arithmetic operations (additions and multiplications) as the corresponding DCT types."
Signal Processing Toolbox has the dct command:

Paul il 20 Dic 2022
It appears that the sine transform can be computed from the Fourier transform.
Example with a simple function
syms t w xi real
f(t) = exp(-t)*heaviside(t);
Fourier transform of f(t)
F(xi) = subs(fourier(f(t),t,w),w,2*sym(pi)*xi)
F(xi) = 
The sine transform is then
S(xi) = simplify(-F(xi) + F(-xi))/2i
S(xi) = 
Compare to the sine transform computed from the defining integral
S(xi) = int(f(t)*sin(2*sym(pi)*xi*t),t,-inf,inf)
S(xi) = 
  2 Commenti
L'O.G. il 20 Dic 2022
Thanks, but how is F(xi) the same as the result for S(xi) in your example?
Paul il 20 Dic 2022
But F(xi) is not the same as S(xi) in the example. Perhaps I don't understand the question ...

Accedi per commentare.





Community Treasure Hunt

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

Start Hunting!

Translated by