CS112 Scientific Computation Department of Computer Science Wellesley College Geese honk, but they don’t wave Sinusoidal waves.

Slides:



Advertisements
Similar presentations
Chapter 8 Improving the User Interface
Advertisements

Desktop Publishing Lesson 1 — Working with Documents.
GUI Testing. High level System Testing Test only those scenarios and outputs that are observable by the user Event-driven Interactive Two parts to test.
Computer Science 1000 LOGO I. LOGO a computer programming language, typically used for education an old language (1967) the basics are simple: move a.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
A graphical user interface (GUI) is a pictorial interface to a program. A good GUI can make programs easier to use by providing them with a consistent.
By Hrishikesh Gadre Session II Department of Mechanical Engineering Louisiana State University Engineering Equation Solver Tutorials.
1 CA203 Presentation Application Presentations by using PowerPoint Lecture # 1 By Tariq Ibn Aziz Dammam Community college.
© The McGraw-Hill Companies, 2006 Chapter 18 Advanced graphics programming.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Automating Tasks With Macros. 2 Design a switchboard and dialog box for a graphical user interface Database developers interact directly with Access.
A Guide to Oracle9i1 Creating an Integrated Database Application Chapter 8.
CS112 Scientific Computation Department of Computer Science Wellesley College Interactive Programs Graphical User Interfaces.
Working with Drivers and Printers Lesson 6. Skills Matrix Technology SkillObjective DomainObjective # Understanding Drivers and Devices Install and configure.
Microsoft Visual Basic 2005 ENRICHMENT CHAPTER Visual Studio Tools for Office.
Technology Basics Creating Worksheet Formulas. 2 Understand Formulas Equations used to calculate values in cells are called formulas. Formulas consist.
SOLVING SUDOKU WITH MATLAB
Programming a GUI Hanan sedaghat pisheh. For calling GUI, we need a function with no inputs or outputs First We create a m.file m file has the same name.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 16: Java Applets & AWT Fundamentals of Web Programming.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Views and Viewports1 Sacramento City College EDT 310.
An Introduction to Visual Basic
Department of Mechanical Engineering, LSUSession VII MATLAB Tutorials Session VIII Graphical User Interface using MATLAB Rajeev Madazhy
A short intermission about function handles and cell arrays A MATLAB function may be referenced by a handle. >> sphere(100)
Introduction to the Graphical User Interface (GUI) in MATLAB
Matlab GUIs GUIDE.
CS 170 – INTRO TO SCIENTIFIC AND ENGINEERING PROGRAMMING.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
HTML presentation Embedding Graphics in Web Pages n HTML uses an empty tag called the (image tag) n n n or n n n Note: all web production tools do insert.
Introduction to Matlab & Data Analysis
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Typing Application Introducing Keyboard Events, Menus, Dialogs and the Dictionary.
Internet Browsing the world. Browse Internet Course contents Overview: Browsing the world Lesson 1: Internet Explorer Lesson 2: Save a link for future.
Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and check boxes using HTML Add a pull-down.
GUI development with Matlab: GUI Front Panel Components 1 GUI front panel components In this section, we will look at -GUI front panel components -Programming.
Basic Controls & Properties Chapter 2. Overview u VB-IDE u Basic Controls  Command Button  Label  Text Box  Picture Box u Program Editor  Setting.
Analog Discovery Arbitrary Function Generator for Windows 7 by Mr
Introduction to Matlab’s Graphical User Interface (GUI) Type “guide” “Guide” creates interface on a Figure window and code in an M-file. Some hidden code.
function varargout = MovieJoiner(varargin) % MOVIEJOINER M-file for MovieJoiner.fig % MOVIEJOINER, by itself, creates a new MOVIEJOINER or raises the.
XP New Perspectives on Microsoft Windows 2000 Professional Windows 2000 Tutorial 1 1 Microsoft Windows 2000 Professional Tutorial 1 – Exploring the Basics.
Laboratory Exercise # 9 – Inserting Graphics to Documents Office Productivity Tools 1 Laboratory Exercise # 9 Inserting Graphics to Documents Objectives:
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 20 Graphical User Interface (GUI)
Python Programming Graphical User Interfaces Saad Bani Mohammad Department of Computer Science Al al-Bayt University 1 st 2011/2012.
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
Introduction to Matlab & Data Analysis 2015 In this tutorial we will: Build a practical application using GUIDE Learn more about graphical user interface.
CS324e - Elements of Graphics and Visualization Java GUIs - Event Handling.
Copyright © Curt Hill More Components Varying the input of Dev-C++ Windows Programs.
GUI development with Matlab: GUI Front Panel Components GUI development with Matlab: Other GUI Components 1 Other GUI components In this section, we will.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 10 1 Microsoft Office Access 2003 Tutorial 10 – Automating Tasks With Macros.
Interactive Frequency Filtering Program Geoff Franz.
Oct 021 Outline What is a widget? Buttons Combo boxes Text components Message boxes.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 13 GUI Programming.
Chapter Eleven The X Window System. 2 Lesson A Starting and Navigating an X Window System.
Slide 1 Using Menu Bar & Common Dialog Boxes. Slide 2 Setting Up the Main Items v First open the form on which you want the menu located v Then start.
CS112 Scientific Computation Department of Computer Science Wellesley College Interactive Programs Graphical User Interfaces.
EGR 115 Introduction to Computing for Engineers
Computer Science [3] Java Programming II - Laboratory Course Lab 4 -1 : Introduction to Graphical user interface GUI Components Faculty of Engineering.
EGR 115 Introduction to Computing for Engineers Graphical User Interface Design in MATLAB - Part 2 Monday 24 Nov 2014 EGR 115 Introduction to Computing.
Introduction to Matlab Module #10 Page 1 Introduction to Matlab Module #10 – Creating Graphical User Interfaces Topics 1.Overview of GUI Development using.
CS112 Scientific Computation Department of Computer Science Wellesley College Blind to change More on GUIs.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
Lecture (7) Introduction to GUI Eng. Osama Talaat 1.
MATLAB and SimulinkLecture 61 To days Outline Graphical User Interface (GUI) Exercise on this days topics.
Customizing Menus and Toolbars CHAPTER 12 Customizing Menus and Toolbars.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
Desktop Publishing Lesson 1 — Working with Documents.
Graphical User Interface in MATLAB
More on Graphical User Interfaces
Chapter 13 Sights and Sounds.
Sine Waves Part II: Data Analysis.
Sine Waves Part II: Data Analysis.
Presentation transcript:

CS112 Scientific Computation Department of Computer Science Wellesley College Geese honk, but they don’t wave Sinusoidal waves

Waves14-2 Creating vibes with GUIs We will build a GUI-based teaching tool to help us identify the parameters of a sinusoidal wave* * Based on an idea suggested by Jim McClellan at Georgia Tech

Waves14-3 Sine functions General form of a sine function: amp*sin(2*  *freq*t + phi) where t = time amp =sine wave amplitude freq = frequency phi = phase, or shift in time

Waves14-4 Using GUIDE’s Layout Editor

Waves14-5 sineGUI Program randomly generates sinusoidal waves and displays “test” sinusoid in upper plot A pattern of brightness that varies in a similar sinusoidal fashion is displayed as an image User enters amplitude, frequency, and phase of sine wave When submit guess button is pressed, the user’s sine wave is drawn at the bottom and a message indicating correctness of guess is printed

Waves14-6 Parameters The program selects three parameters from the following sets of values amplitude: frequency: phase*: * Phase values are angles, in radians, corresponding to -135°, -90°, -45°, 0°, 45°, 90°, 135°, 180°

Waves14-7 Recall functions defined in sineGUI.m sineGUI: top-level function at the beginning of the file that is called from the Command Window. This function initializes the GUI program and opens the GUI window. We will not modify this function sineGUI_OpeningFcn: executed just before the GUI window is made visible. We will modify this function to set up an initial test sine wave for the program sineGUI.m_OutputFcn : returns outputs to the Command Window. We will not modify this function

Waves14-8 Changes to sineGUI_OpeningFcn % --- Executes just before sineGUI is made visible. function sineGUI_OpeningFcn (hObject, eventdata, handles, varargin) % set up parameters and display for initial test sinusoid handles.amplitude = 3; handles.frequency = 1; handles.phase = 1.57; displaySine(handles, 1); % Choose default command line output for sineGUI handles.output = hObject; % Update handles structure guidata(hObject, handles); Always the same first time around Don’t forget to update global structure!

Waves14-9 function displaySine (then) function displaySine (handles, newTest) if newTest axes(handles.testAxes); time = -2:0.02:2; sine = handles.amplitude * sin(2.0*pi*handles.frequency.* … time+handles.phase); plot(time, sine, 'LineWidth', 3, 'Color', 'r'); axis([ ]), grid on axes(handles.imageAxes); image = zeros(25,201); for i = 1:25 image(i,:) = sine(1,:); end imshow(image, [-5 5]); axes(handles.guessAxes); plot(0,0); axis([ ]), grid on set up and display image matrix direct display to testAxes clear guessAxes

Waves14-10 function displaySine (else) function displaySine (handles, newTest)... else axes(handles.guessAxes); amp = str2double(get(handles.ampBox, 'String')); freq = str2double(get(handles.freqBox, 'String')); phase = str2double(get(handles.phaseBox, 'String')); time = -2:0.02:2; sine = amp * sin(2.0*pi*freq*time + phase); plot(time, sine, 'LineWidth', 3, 'Color', 'r'); axis([ ]); grid on end get user’s guesses calculate sine and plot it in guessAxes direct display to guessAxes

Waves14-11 Setting up for the user’s next action So far we’ve been concerned with responding to the user’s current action. We also need to consider, what will the user do next? This may involve enabling and disabling GUI components: set(component, 'Enable', 'on') set(component, 'Enable', 'off') Enabling or disabling a component

Waves14-12 submitButton_Callback function submitButton_Callback (hObject, eventdata, handles) % display sinusoid guessed by user displaySine(handles, 0) % check whether user's guess is correct if ((handles.amplitude == str2double(get(handles.ampBox, 'String'))) & … (handles.frequency == str2double(get(handles.freqBox, 'String'))) &... (handles.phase == str2double(get(handles.phaseBox, 'String')))) set(handles.statusLabel, 'String', 'You got it! Try a new one!'); set(handles.submitButton, 'Enable', 'off'); % disable submit button else set(handles.statusLabel, 'String', 'close -- try again!'); end % Update handles structure guidata(hObject, handles);

Waves14-13 testButton_Callback function testButton_Callback (hObject, eventdata, handles) % create parameters for new test sinusoid handles.amplitude = selectRandom(1:5); handles.frequency = selectRandom([ ]); handles.phase = selectRandom([ ]); displaySine(handles,1); % display new test sinusoid disp(['correct amplitude: ' num2str(handles.amplitude)]); % cheat sheet disp(['correct frequency: ' num2str(handles.frequency)]); disp(['correct phase: ' num2str(handles.phase)]); set(handles.ampBox, 'String', ''); % clear text boxes set(handles.freqBox, 'String', ''); set(handles.phaseBox, 'String', ''); set(handles.submitButton, 'Enable', 'on'); % enable submit button % Update handles structure guidata(hObject, handles);

Waves14-14 Bells and whistles Other things you may want to explore in a GUI for your final project: - adding animation - other GUI components Slider Listbox Radio Buttons - dialog boxes - pull-down menus - mouse control