Presentation on theme: "Interface between Velleman PCSGU250 and MATLAB"— Presentation transcript:
1Interface between Velleman PCSGU250 and MATLAB Week 0Interface between Velleman PCSGU250and MATLAB
2MATLAB Interface for Velleman Scope Download MATLAB Support PackageFollow the instructions in the README file after you unzip the package. There are a few example programs in the support package, which more or less work. I have found that they work reasonably well on a Dell laptop, but one of which did not run properly as-written on my Fujitsu tablet .
3m filesIn MATLAB Support Package are several program that can be used to export library files, used by the Velleman function generator, and to import data from Channel 1 and 2 of the Velleman scope.getScopeData.mmakeSampleLibs.mseeGeneratorOutput.m
4makeSampleLibs.m Creates two library files AM Wave.lib will cause the function generator to output a signal that is the combination of two sine waves. The frequency of one sine wave is at whatever frequency you have selected on the Velleman function generator and the other is at 20 time this frequency.Noisy Sine.lib will add random noise to a sine wave. Note that everyone will create a slightly different Noisy Sine.lib using this function.These .lib files are saved in Velleman directory, which is created by the MATLAB program. You will have to copy them to the LIB directory in the correct directory associated with PcLab2000LT
5getScopeData.mYou start the scope and function generator and measure the data as normal. Then run the MATLAB file getScopeData.m. Data will be imported into two vectors, data1 for the Channel 1 and data2 for Channel 2. Plots of the data will be displayed in MATLAB. For some reason, the scope will turned off after the data has been imported (at least with my computer). I am still reviewing the functions that MATLAB wrote to interface to the scope and haven’t figured out why as of yet.
6seeGeneratorOutput.mYou should have the Velleman oscilloscope connected to your computer and configured to make a measurement on Channel 1. You do not have to launch Velleman PcLab2000LT.The MATLAB programcreates a half wave rectified sine wave lib file and plots it,then starts up the scope and function generator on the PCSGU250,Collects the data from the oscilloscope (which should be the function generator output), andplots it on the same plot.This should match up (roughly) with the original lib file plot.
7New lib FileAs part of the Week 1 assignment, you will modify makeSampleLibs.m to write a library file that will cause the function generator to output three sinusoidal signals at once.Note that 4096 data points in the vector is one full cycle of the fundamental sine wavesin(2pfo) + sin(4pfo) + sin(8pfo)Call the new library file Three Sines.lib
8Adding a new library file Import into the Velleman PcLab2000LT LIB directory on your computer.Launch PcLab2000LT.Click MORE FUNC.Click LIB in the pop-up windowSelect Three Sines.lib from the list of files that are then displayed.
9Collecting DataSet the frequency fo to 10 kHz and the peak-to-peak amplitude to 2V.Connect Channel 1 to function generator output.Save a screen capture of the function generator output as measured using the Velleman oscilloscope programUsing getScopeData.m, collect the signal from the function generator created by your library file and save the plot.
10Spectrum AnalyzerUsing the Spectrum Analyzer option on the Velleman scope, collect a plot that shows the three frequencies in the output of the function generator.Select the Frequency Range such that all three frequencies are on the same plot.Use a linear frequency scaleSelect a reasonable ZoomSave image from spectrum analyzer.
11Pre-lab, Validation, and Post-validation Report No Pre-Lab report.No Validation.Two Post-Lab reportsOne link – upload the m file that you modified to create Three Sines.lib using the correctly labeled assignment linkSecond link – upload the completed report template (found on the Week 0 Module)Screen capture from Channel 1 of the Velleman scope.Screen capture from the Velleman spectrum analyzer that displays three peaks associated with the three components of Three Sines.lib.Plot from MATLAB of the Velleman oscilloscope trace.Due: 8pm on 9/8/2012