Computing > Programming

Oscilloscope bandwidth simulated with Octave/Matlab

(1/4) > >>

ik1zyw:
Hello.
I last used MATLAB three decades ago, when I studied the signal theory. Then never used either in my work life. I do remember practicalities, but not the whole theory, so I need help. Here's what I would like to do.

I have bought a declared 150 MHz bandwidth oscilloscope. I feed to it an impulse train at 14 MHz, with the impulse being (probably) 10 ns long. Given the BW limit, the oscilloscope returns just a few of the harmonics in a curvy signal that looks like the impulse train only because I know what I'm feeding to it.

I would like to build a GNU Octave simulation in order to get a plot similar to the oscilloscope output, which hopefully will tell me more about the system frequency response.

Here's what I would do: define the impulse train in the time domain, FFT it, apply the low pass filter (-3 dB at 150 MHz), IFFT the result back to TD and plot it. If the LPF order and -3dB point are configurable, or swept, sooner or later I should plot a waveform close enough to what is shown on the oscilloscope. Shouldn't I? And yes, I know my impulse is probably more trapezoidal than real squared, but initially I'd keep the assumption that it is ideal.

If I am not too far from a useful experiment, I need to be guided towards a working [Octave] code. I hope someone is willing to help.

TIA,
Paolo

RoGeorge:
Would be easier to simulated with LTspice instead of Matlab or Octave, but there's a well known relation between an analog oscilloscope bandwidth and the rise time that can be seen on the oscilloscope display.

\[ BW = \frac{0.35}{t_r} \]
https://people.ece.ubc.ca/robertor/Links_files/Files/TEK-Understanding-Scope-BW-tr-Fidelity.pdf

The above thumb rule formula is usually not valid for digital oscilloscopes, because the digital ones use different type of filters and signal reconstruction than analog oscilloscopes.

What model is the oscilloscope you want to find the bandwidth for?

snarkysparky:
There is no concept of time in Octave/Matlab.  Just samples.  You do the scaling yourself.
So you have a pulse train that is high 10ns  at a rate of 14 Mhz.   14 Mhz has a period of 71.43 ns.

For oversampling lets pick the high time to be 100 samples.

high = ones(1,100);

%add the off times

signal = [ high  zeros(1,614)];

%repeat this sequence as long as you like

repeat = 5;

full_signal = repmat(signal,1,repeat);


% now make a filter

[b a] = butter(2,0.01);

FilteredSignal = filter(b,a,full_signal);



plot(FilteredSignal);





tggzzz:
If you want to match the response you see on the scope's screen, you will need the same "shape" filter.

Traditional analogue scopes used to have an approximation to a gaussian filter in order to preserve the time-domain waveshape. Filters implemented as DSP algorithms can have any shape the implementeer desired.

ik1zyw:
Thank you for the very insightful answers tackling three different aspects of my "project". I'm really glad I am going to learn (and relearn) something new.

For RoGeorge question, I want to "reverse" an Hantek DSO2D15. The unreliable analog Tek was sold to fund the purchase of the DSO. It needed some servicing that I would be qualified to apply, but it was too large to be serviced in my home lab (and I did not have the second oscilloscope required for troubleshooting). I thought I had taken a picture of the same impulse generator on the analog scope, but that requires digging in 10 years worth of digital pictures.

I will read the linked Tek document later today, and play with the kindly donated code by snarkysparky. I doubt we will ever know the DSP shape chosen by Hantek engineering team.

Paolo


Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version