5.0

5.0 | 1 rating Rate this file 36 Downloads (last 30 days) File Size: 120 KB File ID: #17874
image thumbnail

Simple Plot, Zoom and FFT GUI

by

 

03 Dec 2007 (Updated )

GUI to select a Simulink output file or workspace variable, m-file outputs or oscilloscope data. Zo

| Watch this File

File Information
Description

Simple PLOT , ZOOM and FFT for various oscilloscpope, Simulink or Matlab data formats
 
No input parameter is required to start the program. Input data are selected and loaded from the top-level (start) GUI --->> GetData_vxx.fig.

Implements the selection of a workspace variable generated in the command window or from an *.m file. The voltage (y-axis) data can be in a single row or column. Except for *.mat files from Simulink the data should be ascii. Also, can use Simulink generated 'To File' (*.mat file) or 'To Workspace' ('Array', 'Structure', 'Structure WithTime') block outputs. The GUI can also handle simple *.csv files generated in Excel and some scope types.

Once the data source is selected there is a prompt for the sample frequency and a plot of the input data is shown, allowing a zoom (or not) into a selected time range before performing the FFT. Workspace and *.mat data from Simulink must be sampled using zero-order-hold block if a variable-step solver is selected or use the sample parameter in the save-to-workspace or save-to-file blocks. The sample rate is required to construct the time vector, rather than using a possible input time vector, because outputs from the different data files, scopes and Excel have various time information or formats. The scope data types used in our lab had either no time vector (column or row) or the Y (voltage) vector values are always located at the end of the line (trimmed) after a final blank, tab or comma. Separately entering the sample rate allows more formats to run without special handling for each different type.

 For a file souce, if there are less than 10 lines of data, an ERROR is flagged and the routine goes back to the start-up screen (GUI) for a different (new) WS variable or file selection. Each workspace input data vector is checked for length when loaded at program startup and if there is less than 10 lines are not shown in the WS variable selection scroll box on the GUI. If there are less than 30 lines of data a WARNING is anunciated with the option for a new selection or to continue with the given data.
 
On the FFT GUI there are options to apply a WINDOW or to down sample the data. The windowing does not appear very useful, either because the FFT range is selected visually when using the zoom function or possibly because the window length is always the same size as the data vector? Also,the default log frequency axis can be changed to linear and the default linear gain can be switched to ?d? which was required in the original application.

The input data lines to be plotted must have only numeric data following the last comma, space or tab in the line or the whole line can be numeric. This allows for the Excel (.cvs extension) and ASCII data from the HP and Tektronix oscilloscopes used in our lab. There is limited error trapping. On most errors the program attempts to start over by cleaning up and putting back up the GetData window for a different (new) data input.

The development was with WINDOWS OS using a 1280 x 800 screen, but works OK down to 1024 x 768 resolution. Screens set at any_width x 600 do not work. OTHER: Gateway MX6453 laptop. Windows XP Professional Service Pack 2, Dual-Core AMD (1.596 Mhz).
  
The programs are a mix of nested functions and GUIDE developed. The nested functions appear preferrable . Suggestions are requested for details on better optimization, program organization, data handling...etc.

Required Products Simulink
MATLAB release MATLAB 7 (R14)
Other requirements Windows OS, Greater than 1Ghz and at least 1024 x 768 resolution.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
15 Aug 2008 Prio Sasoko  

Contact us