Вы находитесь на странице: 1из 6

1 MATLAB:1.1 Introduction:1. MATLAB is numeric computation software for engineering and scientific calculations.

MATLAB is primarily a tool for matrix computations. MATLAB is being used to teach filter design, random processes, control systems and Communication Theory. 2. The MATLAB exercises cover sinusoidal ac analysis, network characteristics and frequency response. Some MATLAB functions that are useful in teaching ac circuit analysis are introduced. The MATLAB programs for doing the exercises have been provided. 3. MATLAB is numeric computation software for engineering and scientific calculations. MATLAB is primarily a tool for matrix computations. . MATLAB is a high level language whose basic data type is a matrix that does not require dimensioning. There is no compilation and linking of programs as it is normally done in other high level languages, such as C or FORTRAN. 4. In MATLAB, all computations are done in complex valued double precision arithmetic to guarantee high accuracy. MATLAB has a rich set of plotting capabilities. The graphics are integrated into MATLAB. Since MATLAB is also a programming environment, a user can extend the functional capabilities of MATLAB by writing new modules. 5. MATLAB has a large collection of toolboxes for variety of applications. A toolbox consists of functions that can be used to perform some computations in the toolbox domain. Some examples of MATLAB toolboxes are: signal processing, image processing, neural network, control system, statistics, symbolic mathematics, and optimization and system identification. At present, there is no MATLAB toolbox for circuit analysis and communication theory. MATLAB is being used to teach filter design, random processes, control systems and Communication Theory.

1.2 Advantages of MATLAB over C and C ++:-

1. As the functions are already provided in the package there is not much of programming overhead for the user. 2. User friendly. 3. As the complex circuits are implemented using software, the scope of improvement increases As matlab is having number of function available for the speech recognition .this are as follows:

Wavrecord
Record sound using a PC-based audio input device.

Syntax
y = wavrecord(n,Fs) y = wavrecord(...,ch) y = wavrecord(...,'dtype')

Description
y = wavrecord(n,Fs) records n samples of an audio signal, sampled at a rate of Fs Hz (samples per second). The default value for Fs is 11025 Hz. y = wavrecord(...,ch) uses ch number of input channels from the audio device. ch can be either 1 or 2, for mono or stereo, respectively. The default value for ch is 1. y = wavrecord(...,'dtype') uses the data type specified by the string 'dtype' to record the sound. The string 'dtype' can be one of the following: 'double' (default value), 16 bits/sample 'single', 16 bits/sample 'int16', 16 bits/sample 'uint8', 8 bits/sample RemarksStandard sampling rates for PCbased audio hardware are 8000, 11025, 2250, and 44100 samples per second. Stereo signals are returned as two-column matrices. The first column of a stereo audio matrix corresponds to the left input channel, while the second column corresponds to the right input channel.

Examples
Record 5 seconds of 16-bit audio sampled at 11025 Hz. Play back the recorded sound using wavplay. Speak into your audio device (or produce your audio signal) while the wavrecord command runs. Fs = 11025;

y = wavrecord(5*Fs,Fs,'int16'); wavplay(y,Fs);

2.wavplay Play recorded sound on a PC-based audio output device Syntaxwavplay(y,Fs) wavplay(...,'mode')

Description
wavplay(y,Fs) plays the audio signal stored in the vector y on a PC-based audio output device. You specify the audio signal sampling rate with the integer Fs in samples per second. The default value for Fs is 11025 Hz (samples per second). wavplay supports only 1- or 2channel (mono or stereo) audio signals. wavplay(...,'mode') specifies how wavplay interacts with the command line, according to the string 'mode'. The string 'mode' can be 'async' (default value): You have immediate access to the command line as soon as the sound begins to play on the audio output device (a nonblocking device call). 'sync': You don't have access to the command line until the sound has finished playing (a blocking device call). The audio signal y can be one of four data types. The number of bits used to quantize and play back each sample depends on the data type.Data Types for wavplay Data TypeQuantizationDouble-precision (default value)16 bits/sampleSingleprecision16 bits/sample16-bit signed integer16 bits/sample8-bit unsigned integer8 bits/sampleRemarksYou can play your signal in stereo if y is a two-column matrix.

Examples
The MAT-files gong.mat and chirp.mat both contain an audio signal y and a sampling frequency Fs. Load and play the gong and the chirp audio signals. Change the names of these signals in between load commands and play them sequentially using the 'sync' option for wavplay. load chirp; y1 = y; Fs1 = Fs; load gong; wavplay(y1,Fs1,'sync') % The chirp signal finishes before the wavplay(y,Fs) % gong signal begins playing.

figure
Create a figure graphics object

Syntax
figure figure('PropertyName',PropertyValue,...) figure(h) h = figure(...)

Description

figure creates figure graphics objects. Figure objects are the individual windows on the screen in which MATLAB displays graphical output. figure creates a new figure object using default property values. figure('PropertyName',PropertyValue,...) creates a new figure object using the values of the properties specified. MATLAB uses default values for any properties that you do not explicitly define as arguments. figure(h) does one of two things, depending on whether or not a figure with handle h exists. If h is the handle to an existing figure, figure(h) makes the figure identified by h the current figure, makes it visible, and raises it above all other figures on the screen. The current figure is the target for graphics output. If h is not the handle to an existing figure, but is an integer, figure(h) creates a figure and assigns it the handle h. figure(h) where h is not the handle to a figure, and is not an integer, is an error. h = figure(...) returns the handle to the figure object.

plot
Linear 2-D plot Syntaxplot(Y) plot(X1,Y1,...)

Description
plot(Y) plots the columns of Y versus their index if Y is a real number. If Y is complex, plot(Y) is equivalent to plot(real(Y),imag(Y)). In all other uses of plot, the imaginary component is ignored.

fft
Discrete Fourier transform

Syntax
Y = fft(X) Y = fft(X,n) Y = fft(X,[],dim) Y = fft(X,n,dim)

Definition
The functions X = fft(x) and x = ifft(X) implement the transform and inverse transform pair given for vectors of length by: where is an th root of unity.

Description
Y = fft(X) returns the discrete Fourier transform (DFT) of vector X, computed with a fast Fourier transform (FFT) algorithm. If X is a matrix, fft returns the Fourier transform of each column of the matrix. If X is a multidimensional array, fft operates on the first nonsingleton dimension. Y = fft(X,n) returns the n-point DFT. If the length of X is less than n, X is padded with trailing zeros to length n. If the length of X is greater than n, the sequence X is truncated. When X is a matrix, the length of the columns are adjusted in the same manner. Y = fft(X,[],dim) and Y = fft(X,n,dim) applies the FFT operation across the dimension dim. ExamplesA common use of Fourier transforms is to find the frequency components of a signal buried in a noisy time domain signal. Consider data sampled at 1000 Hz.

Form a signal containing 50 Hz and 120 Hz and corrupt it with some zero-mean random noise: 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)')

It is difficult to identify the frequency components by looking at the original signal. Converting to the frequency domain, the discrete Fourier transform of the noisy signal y is found by taking the 512-point fast Fourier transform (FFT): Y = fft(y,512); The power spectrum, a measurement of the power at various frequencies, is Pyy = Y.* conj(Y) / 512; Graph the first 257 points (the other 255 points are redundant) on a meaningful frequency axis: f = 1000*(0:256)/512; plot(f,Pyy(1:257)) title('Frequency content of y') xlabel('frequency (Hz)')

This represents the frequency content of y in the range from DC up to and including the Nyquist frequency. (The signal produces the strong peaks.) AlgorithmThe FFT functions (fft, fft2, fftn, ifft, ifft2, ifftn) are based on a library called FFTW [3],[4]. To compute an -point DFT when is composite (that is, when ), the FFTW library decomposes the problem using the Cooley-Tukey algorithm [1], which first computes transforms of size , and then computes transforms of size . The decomposition is applied recursively to both the - and -point DFTs until the problem can be solved using one of several machine-generated fixed-size "codelets." The codelets in turn use several algorithms in combination, including a variation of Cooley-Tukey [5], a prime factor algorithm [6], and a split-radix algorithm [2]. The particular factorization of is chosen heuristically. When is a prime number, the FFTW library first decomposes an -point problem into three ()-point problems using Rader's algorithm [7]. It then uses the Cooley-Tukey decomposition described above to compute the ()-point DFTs. For most , real-input DFTs require roughly half the computation time of complex-input DFTs. However, when has large prime factors, there is little or no speed difference. The execution time for fft depends on the length of the transform. It is fastest for powers of two. It is almost as fast for lengths that have only small prime factors. It is typically several times slower for lengths that are prime or which have large prime factors. Note You might be able to increase the speed of fft using the utility function fftw, which controls how MATLAB optimizes the algorithm used to compute an FFT of a particular size and dimension. Data Type Supportfft supports inputs of data types double and single. If you call fft with the syntax y = fft(X, ...), the output y has the same data type as the input X.

hamming
Compute a Hamming window Syntaxw = hamming(n) w = hamming(n,'sflag')

Description
w = hamming(n) returns an n-point symmetric Hamming window in the column vector w. n should be a positive integer. The coefficients of a Hamming window are computed from the following equation. w = hamming(n,'sflag') returns an n-point Hamming window using the window sampling specified by 'sflag', which can be either 'periodic' or 'symmetric' (the default). When 'periodic' is specified, hamming computes a length n+1 window and returns the first n points. Note If you specify a one-point window (n=1), the value 1 is returned.

Вам также может понравиться