Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Descriptive Statistics I: By the end of this class you should be able to: • Program cords and delays in your music programs • plot a histogram of absolute frequencies and describe its nature vary the number of bins in a histogram and choose an appropriate number plot a histogram of relative frequencies and explain why it is needed. • • Palm: Section 7.1, 7.2 Practice Problem (groups of 3): A debugging a Sine Series Function • The sin function can be approximated by the series: k *2 1 n x3 x5 x sin( x) x (1) k 1 3! 5! (k * 2 1)! k 1 • Download the function: SinSeries1.m from the website • This function was developed to estimate the sine using the above series given the x-value and n, the number of terms to be used in the sequence. • Follow the instructions on the worksheet handout. function S = SinSeries(x,n) Flowchart for Sine Series Problem Calculate first term S=x Done with index array for terms 2 through n S = S + new term End Working with Chords download “chordplay.m” from the “Music in MATLAB’ page Open this script in the MATLAB editor. Exercise instructions and questions are in the comments of this script. Please write down answers to these questions. To “uncomment” remove the “%” from the beginning of a line Exercises 1: Play a major chord 1. What are the names for these three notes? 2. What advantage can you see to calculating them this way instead of just typing in the frequencies? 3. How are the three note series combined into one series/chord. Exercise 2: Add a delay 4. How is the delay created? 5. Why is the pad added at the end of the first note twice? 6. What are the dimensions of the chord array? Exercise 3: Play two notes in stereo 7. What are the dimensions of the chord array now? Saving and Loading .wav files • Loading .wav files: >> [series, sf, bits] = wavread(‘wavfile’) • Saving a .wav: >> wavwrite (series, sf, bits, ‘filename’) • Import Wizard: File Import Data Characteristics of a stored ware 1 Series: The list of yvalues for the wave. 0.8 0.6 Sampling Frequency: how many times per second you have a data point = 1/(interval between points) 0.4 amplitude 0.2 0 -0.2 Bits: The number of significant figures used in the y-values (in binary) -0.4 -0.6 8 bits = 256 levels 16 bits = 65,536 levels 24 bits = 16 x 106 levels -0.8 -1 0 0.5 1 1.5 time(sec.) 2 2.5 -3 x 10 Descriptive Statistics please download cordbreak1.mat & load into MATLAB Palm: Section 7.1, 7.2 Histogram: a frequency plot >> hist(cord) >> xlabel 'breaking force (N)' >> ylabel 'absolute frequency' Histogram Bins • Bins can greatly effect the look of a histogram • By default MATLAB uses 10 bins • Adjusting bins in MATLAB: >> hist(cord, n) where n is the number of bins desired • Exercise: Create a figure with four plots arranged 2x2 where the plots are histograms of the cordbreak data with bin numbers of 10, 20, 5 and 7. Histogram Commands >> hist (data) histogram with 10 equal width bins >> hist(data, number of bins) histogram with specified number of bins >> [z, x] = hist(data) no histogram produced outputs a vector of heights (z) and the center point of each bin (x) try using this command. Then try >> bar(x, z) >> hist(data, vector of bin centers) bins are centered at the provided values Relative Frequency Histogram • Try this: >> [z,x]=hist(cord); >> zr=z/sum(z) >> bar(x,zr) add axis labels etc. • Frequency is relative to the total number of samples (N). Each bar is the fraction of samples in that bin • This histogram is independent of total sample size Formula MATLAB EXCEL >> mean(variable) = average(range) >> std(variable) = stdev(range) n Mean Sample Standard Deviation x x i 1 i n n sx 2 ( x x ) i i 1 n 1