# Suitable sampling rate for triangle wave

I know this is a fairly simple question but I can't convince myself of the right answer.

For a 5KHz triangle wave, being sample at Fs sampl/second, what's a suitable choice for Fs such that an accurate reconstruction of the cont. time wave can be generated?

My first thought was to satisfy Nyquist, so sample at twice at the wave rate. But, is there something I'm missing here? Like for the square wave, where technically the sample rate is infinite for a perfect reconstruction, is there something similar here?

Thanks!

• yes, a true triangle wave has an infinite number of harmonics. you need to learn a bit about Fourier Series, and then, if this is for music synthesis, what bandlimited waveforms are. there is such a thing as a "bandlimited triangle wave" just as there is a "bandlimited sawtooth" or a "bandlimited square wave". if you want to generate a wavetable of such a bandlimited wave, there's a pretty easy way to do it with the FFT and inverse FFT. – robert bristow-johnson Nov 9 '17 at 9:36

The 5kHz is the repetition frequency and it's not the maximum frequency of your signal or its bandwidth and your signal isn't band-limited but it has small frequency content over very high frequencies which lead to the Fat32 answer.

but there are other sampling and reconstruction scheme for non band-limited signals like Finite Rate of Innovation (FRI) which could perfectly reconstruct certain families of non band-limited signals like piecewise polynomials (which your signal exactly fits in) with finite sampling rate (in your case 6 sample per each repetition).

• This is what I was looking for. Thank you! – dsp_yes Nov 9 '17 at 19:36

What's the potential trap here is the statement

a 5 kHz triangle wave...

which actually indicates the fundamental frequency rather than the bandwidth. So you are right. If you sample a triangle wave of fundamental frequency $5$ kHz at a sampling rate of $F_s = 10$ kHz, you will have aliasing, and may obtain an insufficient, unfaithful reproduction of the triangle wave.

In order to obtain a faithful reproduction of the triangle wave , you first determine its approximate bandwidth and then sample it at twice that frequency.

The approximate bandwidth can be obtained from a CTFS expansion of the periodic wave and looking for the range of frequencies in which more than 95% of the energy/power of the wave is stored.

In your case of the triangular wave, just first few harmonics include almost all the energy, so you will be good at producing it faithfully bu sampling anything more than 20 kHz.

Adding one more answer with a different perspective:

1. A triangle wave has infinite bandwidth, hence you can't sample it "accurately", at least not in theory
2. For any practical implementation you need to define your requirements about "what's good enough", i.e. which are the aspects of the ideal triangle wave that you care about
3. Requirements could be "99% of the energy", "no audible difference", "passes visual inspection test", "less than +- 1% max deviation in the time domain waveform", etc.

The question as stated cannot be answered without a proper formulation of your requirements. That is often at the core of many real world engineering problems: nothing is ideal and the key part of the work is to figure out what's good enough.