# How do you do a sine transform in Matlab?

18 Ansichten (letzte 30 Tage)
L'O.G. am 19 Dez. 2022
Kommentiert: Paul am 20 Dez. 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.
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Star Strider am 19 Dez. 2022
In general, a Fourier transform is defined as:
where:
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 Kommentare1 älteren Kommentar anzeigen1 älteren Kommentar ausblenden
Star Strider am 19 Dez. 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
sympref('AbbreviateOutput',false);
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) =
1
figure
fplot(F, [-1 1]*15)
grid
title('Transform plotted as a function of frequency')
xlabel('Frequency')
ylabel('Magnitude')
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.)
.

Melden Sie sich an, um zu kommentieren.

### Weitere Antworten (2)

Bora Eryilmaz am 19 Dez. 2022
Bearbeitet: Bora Eryilmaz am 19 Dez. 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: https://www.mathworks.com/help/signal/ref/dct.html
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Paul am 20 Dez. 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 Kommentare1 älteren Kommentar anzeigen1 älteren Kommentar ausblenden
Paul am 20 Dez. 2022
But F(xi) is not the same as S(xi) in the example. Perhaps I don't understand the question ...

Melden Sie sich an, um zu kommentieren.

### Kategorien

Find more on Time-Frequency Analysis in Help Center and File Exchange

R2021b

### Community Treasure Hunt

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

Start Hunting!

Translated by