User Tools

Site Tools


matlab_guide

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
matlab_guide [2015/08/11 14:05]
graham [fclose]
matlab_guide [2016/05/09 09:29] (current)
a_west [Interp]
Line 48: Line 48:
   * [[matlab_guide#​Files| Files]]   * [[matlab_guide#​Files| Files]]
                 * [[matlab_guide#​fopen| fopen]]                 * [[matlab_guide#​fopen| fopen]]
-                * [[matlab_guide#​fscanfscan]]+                * [[matlab_guide#​fscanffscanf]]
                 * [[matlab_guide#​fclose| fclose]]                 * [[matlab_guide#​fclose| fclose]]
   * [[matlab_guide#​Audio| Audio]]   * [[matlab_guide#​Audio| Audio]]
Line 63: Line 63:
  
 ===== Matlab Basic Operations ===== ===== Matlab Basic Operations =====
- 
  
 === Introduction === === Introduction ===
  
-MATLAB is a numeric ​computation computer software. All of the data types are matrices that can  +MATLAB is a numerical ​computation computer software. All of the data types are matrices that can  
-either represent numeric or string variables. It is also case sensitivei.e. is not the same as B.  ​ +either represent numeric or string variables. It is also case sensitive ​(i.e. '​b' ​is not the same as 'B').  ​
  
  
 === Basic setup === === Basic setup ===
  
-When you open up MATLAB you have three basic windows available: Current Folder, Command Window, and Workspace. ​+When you open up MATLAB you have three basic windows available: Current Folder, Command Window, and Workspace. 
 + 
 The Current Folder window informs the user what folder MATLAB is currently working out of, and displays all of  The Current Folder window informs the user what folder MATLAB is currently working out of, and displays all of 
 the files located withing that folder. The Command Window prompts the user for input by the **>>​** symbol. Once  the files located withing that folder. The Command Window prompts the user for input by the **>>​** symbol. Once 
Line 216: Line 215:
 </​code>​ </​code>​
  
-Length returns the number size of the largest dimension. If row >> column then it will return the length of +Length returns the number size of the largest dimension. If row > column then it will return the length of 
-the row. If column ​>> row then it will return the length of the row.+the row. If column > row then it will return the length of the column.
  
 <​code>​ <​code>​
Line 1426: Line 1425:
  
 ===== fopen ===== ===== fopen =====
-== External Resources == 
 == Description == == Description ==
 Opens up the file specified by the file name.  Opens up the file specified by the file name. 
Line 1441: Line 1439:
  
 ===== fscanf ===== ===== fscanf =====
-== External Resources == 
- 
 == Description == == Description ==
- 
 Reads data from an open text file\\ Reads data from an open text file\\
  
Line 1450: Line 1445:
 //A = fscanf(variable_name,​formatSpec);//​\\ //A = fscanf(variable_name,​formatSpec);//​\\
  
-Example: ​+**Example:** 
     File count.dat contains three columns of integers. Read the values in column order, ​     File count.dat contains three columns of integers. Read the values in column order, ​
     and transpose to match the appearance of the file:     and transpose to match the appearance of the file:
Line 1459: Line 1454:
 Type //'​help fscanf'//​ in the command window of matlab for more details ​   Type //'​help fscanf'//​ in the command window of matlab for more details ​  
 ===== fclose ===== ===== fclose =====
-== External Resources == +== Description == 
-== Description == \\+
 Closes the file\\ Closes the file\\
  
Line 1473: Line 1467:
 ===== sound ===== ===== sound =====
 == External Resources == == External Resources ==
 +[[https://​www.youtube.com/​watch?​v=ie7iREcYBPU|Great tutorial about combining drums, bass, and a guitar wave files]]
 == Description == == Description ==
  
-====== ​Interp ​======+Play an array as sound\\ 
 + 
 +**Syntax**\\ 
 +//​sound(Y,​FS);//​ sends the signal in array Y (with sample frequency FS) out to the speakers\\ 
 + 
 +**Example:​**\\ 
 +      load handel 
 +      sound(y,​Fs) 
 +    You should hear a snippet of Handel'​s Hallelujah Chorus. 
 +  
 +Type //'​help sound'//​ in the command window for more details 
 +====== ​Interpolation ​====== 
 +== External Resources == 
 +== Description == 
 +Increases the Sample rate by an integer factor.  
 + 
 +**Syntax:​**\\ 
 +//y = interp(x,​r);//​ This increases the sampling rate of x (input signal) by a factor of r. 
  
 +**Example: **\\
 +  Create a sinusoidal signal that is sampled at 1kHz. Upsample by 6 
 +  t = 0:0.01:1;
 +  x = sin(2*pi*30*t)
 +  y = interp(x,​6);​
 +  ​
 +Type //'​help interp'//​ in command window of matlab for more details.
matlab_guide.1439323512.txt.gz · Last modified: 2015/08/11 14:05 by graham