EGR106 Week 5 - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

EGR106 Week 5

Description:

EGR106 Week 5 – PowerPoint PPT presentation

Number of Views:28
Avg rating:3.0/5.0
Slides: 10
Provided by: james245
Learn more at: http://www.ele.uri.edu
Category:
Tags: by | color | egr106 | number | plus | size | week

less

Transcript and Presenter's Notes

Title: EGR106 Week 5


1
EGR106 Week 5
  • MATLAB FILES
  • Two Dimensional Plots
  • Multiple Plots
  • Plot Formatting
  • Homework

2
MATLAB Files
  • Script files (m files)
  • Text files
  • Contain MATLAB commands
  • Data Files (mat files)
  • binary files
  • Contain arrays (data)
  • Use save and load commands to write and read

3
Two Dimensional Plots
  • Line type
  • plot(x,y,--) gives a dashed line
  • Line color
  • plot(x,y,g) gives a green line
  • Line thickness
  • Markers
  • plot(x,y,--r,linewidth,2,markersize,12)
  • Dashed red line with marker

4
Multiple Plots
  • Plot(x, y1, x, y2) Plots y1 and y2 vs x
  • hold on
  • Keeps the plot window open for additional lines
    on the same plot
  • hold off
  • Stops writing to the plot
  • subplot(n,m,k)
  • Selects plot k in an nxm array of plots.
  • Used for multiple plots on the same page.

5
Plot Formatting
  • xlabel, ylabel
  • xlabel(time (sec))
  • title
  • title(Problem 3 Solution)
  • text
  • text(x,y,your message at coordinates x,y)
  • legend
  • legend(first curve,second curve)
  • used for multiple curves on a single plot

6
Plot Formatting
  • Subscripts and superscripts
  • Greek letters
  • Rotating text

7
gtgt x0210 gtgt yx.2 gtgt plot(x,y,'--r','linewi
dth',2,'markersize',12) gtgt text(2,50,'\fontsize30
\alpha Profit x2 ', 'rotation',45)
8
sound_in sounddata Note
that data is a one column array with 8000
rows. echo(400112000,1)sound The echo is
the sound delayed 4000 units (4000/8000 sec)
Writing into rows 400112000
automatically sets rows 14000 equal to
zero. sound(800112000,1)0 Pad the end
of the sound with zeros so echo and
sound are the same size. data sound 0.25echo
Attenuate the echo to 25 of the sound
and add it to the original
sound. pause(2) Wait 2
seconds to hear the sound plus the echo. sound_out
9
Array Addressing
Store Audio number(,1) zero store
zero in column 1 number(,2) one
additional digits are stored number(,3) two
in column number 1.
Get User Number no input('What is the first
digit? ') data number(,no1) Read
audio from memory
no input('What is the next digit? ') data
data number(,no1) build data array

sound_out
Write a Comment
User Comments (0)
About PowerShow.com