How do you do a sine transform in Matlab?

32 ビュー (過去 30 日間)
L'O.G.
L'O.G. 2022 年 12 月 19 日
コメント済み: Paul 2022 年 12 月 20 日
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.

採用された回答

Star Strider
Star Strider 2022 年 12 月 19 日
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 件のコメント
L'O.G.
L'O.G. 2022 年 12 月 19 日
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 2022 年 12 月 19 日
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.)
.

サインインしてコメントする。

その他の回答 (2 件)

Bora Eryilmaz
Bora Eryilmaz 2022 年 12 月 19 日
編集済み: Bora Eryilmaz 2022 年 12 月 19 日
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

Paul
Paul 2022 年 12 月 20 日
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 件のコメント
L'O.G.
L'O.G. 2022 年 12 月 20 日
Thanks, but how is F(xi) the same as the result for S(xi) in your example?
Paul
Paul 2022 年 12 月 20 日
But F(xi) is not the same as S(xi) in the example. Perhaps I don't understand the question ...

サインインしてコメントする。

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by