10
$\begingroup$

We know that DFT (discrete Fourier transform) breaks down a signal into multiple frequencies of sine waves. Does there exist a transform that does the same thing, but for triangle waves?

For my purposes, im only talking about 1-d signals (like voltages, etc). I'm studying historical stock market data, and I just want to look at reversals in certain stocks. In other words, I want to perform a "low-pass" on the stock price using this transform.

Edit: If yes, how can I do it?

$\endgroup$
3
  • 1
    $\begingroup$ For any signal, I don't think so, but would love to see a proof why not. If you know the signal is composed of triangle waves then might be possible to work out their individual frequency, phase and amplitude. $\endgroup$ May 7, 2013 at 7:39
  • 3
    $\begingroup$ Simple reasoning says that it should be possible for any signal. Since triangles themselves can be represented by sine signals of differing frequencies and can be scaled. The real question is what would you infer from it and would such inferences be practically useful? $\endgroup$
    – Naresh
    May 7, 2013 at 9:28
  • $\begingroup$ Well, i'm studying historical stock market data, and I just want to look at reversals in certain stocks. In other words, I want to perform a "low-pass" on the stock price using this transform $\endgroup$
    – hassan789
    May 7, 2013 at 12:49

6 Answers 6

3
$\begingroup$

The answer to this question is yes. There exist a fast triangle transform, FTT, for triangle waves which has a complexity of $N\log_2(N)$, where $N$ is the number of elements. It works the same like FFT and DFT, and it uses complex vectors, which means it will give you phase information for each triangle wave as well! Please have a look at the C-code function, mbin_ftt_fwd_cf() here.

--HPS

$\endgroup$
9
$\begingroup$

The closest orthogonal transform I know of that might meet your needs is the Slant Transform. It's based on sawtooth(ish) waves, but some of the basis functions do resemble triangle waves:

Slant Basis Functions

(source: Applied Fourier transform)

It was developed for image coding/compression, but it seems like a reasonable first approach for the analysis of long-term linear trends/reversals in financial data. It doesn't seem like many of the key papers describing the transform are available [for free] online, but the following paper probably has sufficient detail to implement something:

A Truncation Method for Computing Slant Transforms with Applications to Image Processing. M. M. Anguh, R. R. Martin. IEEE Trans. Communications 43 (6), 2103-2110, 1995. (author link) (pdf link)

Specifically, see Section III which gives the recursion relations used to construct the transform matrix.

$\endgroup$
4
  • $\begingroup$ looks promising! $\endgroup$
    – hassan789
    May 7, 2013 at 23:11
  • $\begingroup$ using this Matlab code: eeweb.poly.edu/iselesni/slantlet/index.html I will provide feedback soon... $\endgroup$
    – hassan789
    May 7, 2013 at 23:29
  • $\begingroup$ I don't think the Slantlet Transform is the same thing as the Slant Transform. Both might be useful though. $\endgroup$
    – datageist
    May 8, 2013 at 0:13
  • $\begingroup$ "I will provide feedback soon..." $\endgroup$
    – CTZStef
    Nov 15, 2023 at 13:01
5
$\begingroup$

You can do a transform that uses triangle waves instead of sine waves, but it is not a good choice because they are not orthogonal. Orthogonality is an important property of transform vectors.

Properties of Orthogonal Transforms

Orthogonal Transformation

$\endgroup$
2
  • 1
    $\begingroup$ hmmm... im not as advanced when it comes to orthogonality... Honestly, I don't understand what the implication of orthogonality is. Does it ultimately mean that it takes more CPU cyles to do the transform (full transform kernel vs sparse transform kernel)? $\endgroup$
    – hassan789
    May 7, 2013 at 23:14
  • $\begingroup$ @hassan789 The practical implication of orthogonality is that the "DFT" coefficients can be calculated in any order and they will have the same value regardless of the order of calculation. Without orthogonality, the "DFT"coefficients will depend on the order in which the coefficients are calculated. $\endgroup$ Jan 7 at 3:21
5
$\begingroup$

First order B-splines are triangles, and there exist algorithms to represent an arbitrary signal as a sum of B-splines. As mentioned, these splines do not form an orthobasis, but this is not necessarily a terrible thing.

A good place to start is the the paper by Unser on efficient B-spline approximation. http://bigwww.epfl.ch/publications/unser9301.pdf

$\endgroup$
1
  • 1
    $\begingroup$ this is a good start, and actually might be better for me, especially if I can use parabolic b-splines instead of cubic ones.... will read/learn more into this as well $\endgroup$
    – hassan789
    May 7, 2013 at 23:17
1
$\begingroup$

re earlier comment: hmmm... I'm not as advanced when it comes to orthogonality... Honestly, I don't understand what the implication of orthogonality is. Does it ultimately mean that it takes more CPU cycles to do the transform (full transform kernel vs sparse transform kernel)?

Orthogonality means a problem can be broken down into 2 or more separate parts which can be solved individually without affecting the other part, and then recombined to give a final solution. Simple example is x and y vector of someone swimming across the river. The speed and direction of a swimmer can be resolved into x and y components to solve time to cross and landing point (obviously no recombination required in this case!). By making the problem 'tractable', it can be solved efficiently.

Orthogonality therefore won't affect CPU cycles, but the way the solution is set up in software will affect the cycles (e.g. different software solutions to calculating a sine wave/inverse of - as used in a Fourier transform - can make a significant difference in CPU cycles/time to solve).

$\endgroup$
2
  • $\begingroup$ Although what you write is true, I don’t see how this answers the question posted here. I believe this is more of a comment and although I do understand that you don’t have enough reputation to comment on other people’s posts, please refrain from posting them as answers. $\endgroup$
    – ZaellixA
    Jan 5 at 23:42
  • 1
    $\begingroup$ Hi Zaelixa - I agree it doesn't answer the original question about triangular based ratehr than sine based DFT, but it does anser the sub question about whether CPU cycles is linked to orthogonality, which it isn't. So the test is whether the person asking about orthogonality thinks the question is answere dor not. But your point is noted. $\endgroup$
    – thomasm5
    Jan 7 at 11:01
0
$\begingroup$

You could use the adjoint of the integrator operator (i.e. cumsum) followed by a Fast Walsh-Hadamard transform.

e.g. in Matlab

n = 16;
H = fwht(eye(n))*sqrt(n); % Walsh-Hadamrd in full unitary matrix form
S = cumsum(eye(n)); % the integrator in full matrix form
T = H*S';  % cumsum along the rows of the W-H 

The sections of constant positive values in H integrate to cause inclines in the sawtooth waves; negative values become decline.

T is not unitary which has repercussions for dimensional stretching. On the bright side, it does have a fast inverse: another fwht followed by a differentiator.

D = inv(S');  % difference matrix with an extra row at bottom for full rank
Tinv = D*H;   % inverse of T
$\endgroup$
1
  • 1
    $\begingroup$ Could you explain this a bit more? I don't see how integration before the WHT will give the desired result. $\endgroup$ May 8, 2013 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.