Da

Da

My goal is to generate a waveform that has a shape similar to an M rather than a sine wave.

Why? What is it going to do for you?

Pete

no not likely unless you are counting on the ripple to make your wave-shape... an M shaped wave form would have a high second harmonic content. a Cheby filter even two poles would put that harmonic about 6 - 9 db down so... No filter.. really a simple one or two pole low pass with the corner set at twice the fundamental... to clean up some of the switching artifacts. If Truly what you want is an exact M shape the easiest method I can think of is to use a sine look-up table and a port to sort of PWM an "M" shape... Assuming that the repetition rate is low enough, you didn't state the reason for such a harmonically rich waveform but -what you need to build is an arbitrary waveform generator... I hope this helps...

Doc

You're going to be making a periodic function, with the period determined by the timer rate and the tuning word. Whatever shape it is, it's the sum of some sine functions, each with a frequency equal to / , and with some phase angle that could be anything. Those sine-shaped components make up the Fourier series representation of the signal. How it will respond to the Chebyshev filter depends on the frequencies of the various sine-shaped components, and the filter's order, and its cutoff frequency. In the project you reference, that looks to me like a fifth order filter, and they say its cutoff frequency is 12 kHz

You don't say what "M"-shaped means to you. If you select it for the simplest Fourier series, it's asin(jpi/256) + bsin(3j*pi/256) - a sine signal with a pronounced third harmonic. For frequencies below about a tenth of the filter's cutoff frequency, you won't see much change between the input and the output of the filter. Frequencies well above the cutoff frequency will practically vanish. Frequencies in the neighborhood of the cutoff will be attenuated, and will exhibit a phase shift. So, if your output has components that approach the filter cutoff, or are above it, it'll come out looking different from a straightforward graph of your "sine256" array. If it doesn't, then you should see about what you expected.

It would be interesting to know why you want to do this, what your "sine256" table is, and how well it works when you're done.

Somehow I don't think a Cheby filter would be applicable to an Arbitrary waveform generator... For a DDS function Yes absolutely a requirement. However from the initial description it would likely more be like a word generator than a sine generator. The OP described a sine function generator (I think and Likely am wrong) and for the middle hump the requirement would be the second harmonic 180 deg out of phase. From my experience and point of view a sine look-up table is necessary or easier a pulse generator and a step function for a rectangular... pulse generator (Even easier as it is a look-up table only. IMO...

Doc

For minimal phase-distortion go with a Bessel filter, not a Chebyshev one.

I think that is group delay rather than phase distortion. Signals processed by a Bessel filter exhibit much less delay if at different frequencies than other types of filters, Years ago I worked for a place that needed a filter to comply with old analog phone lines used for Pager tone signalling (POCSAG signalling or 5 tone encoding) it seemed like the Abrupt non synchronous transitions were "Bleeding" over to other subscribers and we were asked to "limit" the upper bandwidth of the Leased Lines we were renting From Ma Bell... Yeah it was that long ago. The Chief designer tried a Cheby topology and we lost ALL tone paging for a few hours until it was ripped out. A few days later a Bessel was put in place and stayed there for 15 or so years until the facility was phased out. B'sides from her description she wants something to Show a wave form looking like an "M" which is why the Arbitrary wave form stuff. Or did I miss it AGAIN???

Doc

See page 18/36 then 35/36 in the PDF.

Looks like a standard filter output to me (at least one made with real components) -- there always seems to be a hump or a dip in the middle of the bandpass. :slight_smile:

Your table describes many cycles of a repetitive waveform - it looks like just a little bit less than 16 cycles. You've described it as the sum of three cosine components, with a pronounced second harmonic, and a small third harmonic.

To respond directly to your question:

Will the Chebychef lowpass filter work as well to output the M shaped waveform like it does the sine waveform?

It can, depending on the frequency at which you operate it. With the filter that's shown - declared to have a cutoff frequency of 12 kHz - I think that you'll start to see phase shift effects when the frequency of the highest harmonic approaches 1kHz - and that means that the frequency of the lowest component will be about 330 Hz. Above that frequency, the output signal will look different from the input signal, even though all three frequency components are in the output at almost exactly their input magnitude

If you have exactly 16 cycles in your table, then you'll get 16 cycles for each trip through the table. So, a trip through the table at 330/16 Hz, about 20 Hz, is about as fast as the system can go without visible output distortion. At a 31.4 kHz timer frequency, that amounts to about 1600 ticks for each trip through the table. With 256 entries, each entry will be output about 6 times in a row. You'd get better performance by including fewer cycles in the table - like maybe exactly one cycle, in accordance with the original project's intent - and running it faster.

If phase shift is acceptable to you, then you could run this device at about 4kHz before the amplitude of the highest harmonic was affected, with a 12kHz Chebyshev filter.

At what frequencies do you intend to operate? I'm not sure that the Arduino is an appropriate vehicle for looking at the effects of general relativity on a subatomic scale - I'd expect that you'd need something much faster. What are you trying to do with this thing?

The text in the article that you reference says that the filter is a Chebyshev with a cutoff frequency of 12 kHz. It has five reactive components, which makes me believe that it's a fifth-order filter. It's been an eon since I studied a Chebyshev filter, and I remember little about designing or analyzing them. I haven't verified anything about the filter; I'm just taking the author's word for it.

I believe that you can get an output that closely resembles the input for frequencies less than about 330 Hz. At 330 Hz, the third harmonic is about 1 kHz. With the higest-frequency component in the output - the third harmonic - at a frequency less than one tenth of the filter's cutoff frequency, there won't be much phase shift apparent in the output.

For frequencies above 4kHz, the highest-frequency component will be above the filter's cutoff frequency. The amplitude of the third harmonic will be reduced in the output.

For frequencies in between, the relative magnitude of the three components of the output won't vary by much, but the relative phases of the output components will be different from those of the input. The output will likely look something like this:
U0*(0.997cos(?0t) - 0.503cos(2?0t + phi2) + 0.040cos(3*?0*t + phi3)),
where phi2 and phi3 aren't zero.

Note that I'm describing the filter as if it had an absolutely flat characteristic from DC to 12 kHz. It doesn't, and it deviates most from an ideal characteristic near the cutoff frequency. Chebyshev filters are specified in terms of their "ripple" in the passband. The article doesn't name the fitler's ripple spec. It does state that it's an implementation with standard value components, implying that some accuracy has been sacrificed in favor of using off-the-shelf components. A popular ripple spec is 3dB, which means that the amplitude of the output doesn't vary by more than 3dB as the frequency changes from one point in the passband to another. 3dB corresponds to a factor of 1.4. Your voltage function is specified to three decimal places, suggesting - but not declaring - that your output needs to be more precise than you can get in the neighborhood of the cutoff frequency with a Chebyshev filter.

The waveform in the ODS spreadsheet is a single cycle of the definition that you gave earlier. It's quite different from the table that you posted, which had many cycles. I think that you'll get better results with the table that you have now.

Whether the system and filter, as designed, will work for your application, and the frequencies at which they will give you acceptable results, depend heavily on your requirements for accuracy in the output, and on whether or not a phase shift is acceptable. The DDS project that you point to appears to be intended for the lower half of the audio spectrum, with reasonable, but not great, accuracy for audio. When you point me to a paper that says,

in general relativity the structure of the laws of electricity, magnetism and electromagnetism is changed fundamentally.

it makes me think that you need high frequency,high accuracy, or both.