| Author |
Message |
engineer
Joined: 09 Apr 2005 Posts: 64 Helped: 1
|
02 Jul 2008 16:32 CRO + MATLAB = Spectrum analyzer ? |
|
|
|
hi
i took the picture attached from CRO and I want to analyze it using MATLAB to know the harmonic components in it
I don't have a spectrum analyzer so i want to use MATLAB to do this function.
any help??
regards
|
|
| Back to top |
|
 |
Eugen_E
Joined: 29 Nov 2004 Posts: 306 Helped: 28
|
02 Jul 2008 16:54 Re: CRO + MATLAB = Spectrum analyzer ? |
|
|
|
Take a period measurement, T, and about 20 visual measurements of amplitude, enter them in Matlab and use the interp function to generate a few hundred points. Then use fft, fftshift, abs to get the spectrum. The "sampling" frequency will be 20/T. Generate a frequency scale from -10/T to 10/T, and plot the spectrum.
It is very distorted, if you're looking for pure sine it's very far from that and the circuit should be checked to see what generates the nonlinearity. It seems like a B-E breakdown from a transistor or something similar. When it will look more like sin the measurement makes sense. A THD<5% is not visualy observable in the time domain.
|
|
| Back to top |
|
 |
engineer
Joined: 09 Apr 2005 Posts: 64 Helped: 1
|
04 Jul 2008 0:11 Re: CRO + MATLAB = Spectrum analyzer ? |
|
|
|
thanks Eugen for your reply
I just want to decompose this waveform to its fundamental and harmonics components so that I can know the THD of the nonlinear loads I am using
is there another way?
|
|
| Back to top |
|
 |
echo47
Joined: 07 Apr 2002 Posts: 4212 Helped: 564
|
04 Jul 2008 2:35 CRO + MATLAB = Spectrum analyzer ? |
|
|
|
Do you have some convenient way to transfer that waveform into MATLAB? If it's a digital scope, it should have some sort of data I/O port. It would be tedious and somewhat inaccurate to read points with your eye.
If your scope is analog, maybe you can use your computer's sound card as a digital oscilloscope. It's limited to audio frequency range, but that may be sufficient. MATLAB can input a waveform from a sound card. Modern sound cards have 16-bit converters, which give a nice spectrum.
If that's a high-voltage signal, be careful! Attenuate is to a safe level before feeding it into your computer.
To simply the MATLAB processing, try to pick equally spaced points along the time axis that includes exactly one waveform cycle. For example, if that's a 60 Hz waveform, you could collect 50 points spaced 1/3000 seconds. Then you could feed the points directly into an FFT without having to worry about applying a weighting function. Weighting functions work fine if your data includes many waveform cycles (like from your sound card), but not if it's only one cycle (you scope snapshot).
|
|
| Back to top |
|
 |
engineer
Joined: 09 Apr 2005 Posts: 64 Helped: 1
|
04 Jul 2008 9:41 Re: CRO + MATLAB = Spectrum analyzer ? |
|
|
|
thanks echo47 for your reply
I am working on an analog CRO and a high voltage signal so I can't use the sound card as I think the signal would be distorted from its original waveform if I tried to attenuate it to a low signal
how can I collect the sampling points you are talking about?
|
|
| Back to top |
|
 |
echo47
Joined: 07 Apr 2002 Posts: 4212 Helped: 564
|
05 Jul 2008 6:15 CRO + MATLAB = Spectrum analyzer ? |
|
|
|
A properly built attenuator shouldn't distort the signal. For example, your oscilloscope has a good input attenuator. However, if the voltage is quite high and if you are inexperienced, please don't try to build an attenuator due to the safety hazard.
Another idea -- some scopes have a "vertical out" or "CH1 out" connector on the back panel. It's a low-voltage version of the signal you seen on the CRT. That signal may be suitable for direct connection to a sound card.
If you don't have that option, then your only choice may be to tediously read points from the oscilloscope screen. The results may be mediocre due to the obvious measurement inaccuracies. A frequency transform is very sensitive to distorted data.
Or maybe someone has a program that can digitize the green waveform in your JPEG snapshot. I haven't seen such a thing, but it may exist.
|
|
| Back to top |
|
 |
FvM
Joined: 22 Jan 2008 Posts: 2161 Helped: 365 Location: Bochum, Germany
|
05 Jul 2008 6:33 Re: CRO + MATLAB = Spectrum analyzer ? |
|
|
|
| Apart from the discussed options, THD can be measured with a RMS meter after filtering the fundamental with a bandstop. This has been the standard method for decades. This is rather easy for a several 10 % THD as in the shown case.
|
|
| Back to top |
|
 |
kender
Joined: 19 Jun 2005 Posts: 912 Helped: 68 Location: Stanford, SF Bay Peninsula, California, Earth, Solar System, Milky Way
|
05 Jul 2008 6:50 Re: CRO + MATLAB = Spectrum analyzer ? |
|
|
|
| echo47 wrote: |
| Or maybe someone has a program that can digitize the green waveform in your JPEG snapshot. I haven't seen such a thing, but it may exist. |
I've seen a program like that a couple of years ago. It was a free or OpenSource program. Unfortunately, I don't remember the name or the maker.
|
|
| Back to top |
|
 |