Welcome to the Matlab - Michigan Technological University

Welcome to the Matlab - Michigan Technological University

Introduction to Matlab II EE 2303 Lab Basic Matlab Review Data file input/output string, char, double, struct Types of variables load, save directory/workspace data file movement

Navigation/workspace commands clear clears workspace of all variables close all close all figure-windows Up-arrow scroll through recently used command Basic Matlab Review Fundamentals

of matrix computing [ ], Brackets are used to form vectors and matrices { }, Curly braces are used in cell array assignment ( ), Parentheses Enclose arguments of functions

Enclose subscripts of vectors and matrices Indicate precedence in arithmetic expressions Basic Matlab Review Plotting functions stem() 1-dimensional graphing mesh(), imagesc() 2-dimensional visualization plot(),

Creating Arrays cell(M,N) create M-by-N cell array of empty matrices Individual cells can be any matlab data type Enables matrices with mixed elements e.g.

Creating Arrays zeros(M,N) create M-by-N zeros matrix ones(M,N) create M-by-N ones matrix User Interface Commands

More user-friendly Looks slicker Principal UI commands uigetfile() retrieve files questdlg() input logical buttons

inputdlg() input values uigetfile() Retrieves file via browser window Ex: [audio_input, pathname] = uigetfile('*.wav', 'Please select a wavfile'); inputdlg() Parameter input dialog outputs cell array Ex: lpdlg = inputdlg({'Enter cutoff

frequency(in Hz)'},'Low Pass Filter Parameters',1,{'1000'}); questdlg() Asks question Yes-No-Cancel by default Ex: isdlg = questdlg('Would you like to listen to your input signal?', 'Input sound');

guide GUI Design Environment Alter .fig files

Design selfcontained guis Debug Mode Used for scripts Complex Numbers For a complex signal x of size N real() -- outputs real components imag() outputs imaginary components

abs() yields magnitude angle() yields phase of signal By default, i and j are both set to sqrt(-1) Z = x + j*y can also be written: Z = (x,y) essentially a 2d matrix Discrete Fourier Transform Used to find frequency response of digital

signals Discrete signal input DFT discrete frequency response Matrix form of DFT: N1 kn

X k x n W N n 0 W kn N j 2kn / N e

FFT Example Create an example signal: t = 0:0.001:0.6; x = sin(2*pi*50*t) + sin(2*pi*120*t); y = x + 2*randn(size(t)); plot(1000*t(1:50),y(1:50)) title('Signal Corrupted with Zero-Mean Random Noise') xlabel('time (milliseconds)') FFT Example

Now find the frequency response using the DFT Y = fft(y,512); Pyy = Y.* conj(Y) / 512; f = 1000*(0:256)/512; plot(f,Pyy(1:257)) title('Frequency content of y') xlabel('frequency (Hz)') Lab Exercise

The goal of this lab is to expand your Matlab repertoire through: Debugging a faulty script

Creating a user interface script Creating an audioInput script Approximating Reality EE 2303 Lab References: Oppenheim, Schafer. Discrete-Time Signal Processing. 2nd Edition, 1999, Prentice-Hall. Mathworks Home Page: www.mathworks.com

Recently Viewed Presentations

  • Presentation Name

    Presentation Name

    He also has a Bachelor's Degree in Computer Science from the Aurangabad University, India. He can be reached at [email protected] Project Perfect is a project management software consulting and training organisation based in Sydney Australia. Their focus is to provide...
  • Income Inequality & Black Markets

    Income Inequality & Black Markets

    Global Inequality. Lecture 25: IPE and War Benjamin Graham. Why start with supply and demand? Is Income Inequality Self-Correcting in Democracies? Income inequality may be self-correcting in a democracy. Can we work through how that would work?
  • Today I will: - GeoResource - Home

    Today I will: - GeoResource - Home

    GeographyBiosphere. In Scotland, in general, podzols are found in the north east and brown earths in the east and south east. However, there can be huge variations in soil types across a small area.This can be seen through a section...
  • Weigh the 4 options: pros & cons - Tredyffrin/Easttown School ...

    Weigh the 4 options: pros & cons - Tredyffrin/Easttown School ...

    Loaded words: using words with strong positive or negative connotations, or associations. Name-calling is an example of the use of loaded words. Transfer: making an illogical association between one thing and something else that is generally viewed as positive or...
  • JIF 314 Thermodynamics - fizik.usm.my

    JIF 314 Thermodynamics - fizik.usm.my

    JIF 314 Thermodynamics Sidang Video 2 22 OCT 2008 9.00 pm - 10.00 pm By Yoon Tiem Leong School of Physics, USM Chapters to discuss in the first sidang video Chapter 1: Temperature and the zeroth law of thermodynamics Chapter...
  • Breeding Cattle - UC Agriculture & Natural Resources

    Breeding Cattle - UC Agriculture & Natural Resources

    Mistaking frame size for weight. Moderate cattle that have more volume, width, and substance will weigh more than large framed cattle that are one-dimensional. We will select for moderate cattle that do not compromise practical performance
  • EEE Invention Research Project

    EEE Invention Research Project

    Invention Research Presentation Project Assignment. You will investigate and find a major invention or development that has occurred in the last 90 years (since 1925) to research. You will prepare a short research presentation about the invention you choose to...
  • Laurent Schlosser Directeur Secteur Communication & Mdia 27

    Laurent Schlosser Directeur Secteur Communication & Mdia 27

    Le marché des services hébergés . Le marché pourra connaitre une croissance encore plus forte avec la presssion que nos clients subissent sur leur dépenses d'investissement