Download presentation
Presentation is loading. Please wait.
1
Generation of sound with Matlab Vibes and Waves in Action University of Massachusetts Lowell March 5, 2009
2
What have we learned in the last class? What are beats? How are beats generated? What are the two main characteristics of beats? Can you explain them?
3
What is Matlab? What are some programming languages? What can programming language be used for? Matlab is a scripting language that is often used to solve scientific and mathematical problems both numerically and through visual display. Matlab can be used for: – Calculations – 2D and 3D plotting – Symbolic manipulation of equations – Advanced animation and GUI tools
4
3D Sample plots
5
Matlab fundamentals What is a variable ? – Variable is a place where we store a piece of information. Example : Storing your friend’s phone number in your cell phone. – In Matlab variable names can include letters or numbers Example: nwave,T1,Kenergy,Force1,… Arithmetic Operations – Operators :+,-,*,^,/ – Example Ek=1/2 mv 2 In Matlab: Ek=1/2*m*v^2; List – In additions to doing operations on a single number, Matlab allows us to perform operations on a list of numbers. – One way to create a list is by using a colon notation t=begin:interval:end Example: t=300:10:350 this means that t={300,310,320,330,340,350}
6
Generating plots on Matlab To plot two variables x and y use command plot(x,y); If x and y are defined as x=1:1:8; and y=50:5:85; Label and titles can be added by using commands: xlabel(‘Time of the day [hr]’) ylabel(‘Temperature [F]’) title(‘Change of temperature during a day’)
7
Generate a wave using Matlab Generate t from 0 to 1 seconds (fs=44100) t=0:1/fs:1; Generate a wave with a frequency f=1000Hz f=1000; y=sin(2*pi*f*t); Plot generated wave plot(t,y); Listen to generated waves sound(y,fs);
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.