# How do you do a sine transform in Matlab?

조회 수: 26 (최근 30일)
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 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. 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 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 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
##### 댓글 수: 0이전 댓글 -2개 표시이전 댓글 -2개 숨기기

댓글을 달려면 로그인하십시오.

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. 2022년 12월 20일
Thanks, but how is F(xi) the same as the result for S(xi) in your example?
Paul 2022년 12월 20일
But F(xi) is not the same as S(xi) in the example. Perhaps I don't understand the question ...

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Fast Fourier Transforms에 대해 자세히 알아보기

R2021b

### Community Treasure Hunt

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

Start Hunting!

Translated by