Value must be 'None'. Valid values for this parameter on Windows are
'Indeo3', 'Indeo5', 'Cinepak', 'MSVC', 'RLE' or 'None'.
To use a custom compressor, the value can be the four character code as
specified by the codec documentation. An error will result during the
call to ADDFRAME if it can not find the specified custom compressor.
This parameter must be set before using ADDFRAME.
The default is 'Indeo5' on Windows and 'None' on UNIX.
Note: Indeo5 may not be available in some versions of Windows.
QUALITY - A number between 0 and 100. This parameter has no effect
on uncompressed movies. This parameter must be set before using
ADDFRAME. Higher quality numbers result in higher video quality and
larger file sizes, where lower quality numbers result in lower video
quality and smaller file sizes. The default is 75.
KEYFRAME - For compressors that support temporal compression, this
is the number of key frames per second. This parameter must be set
before using ADDFRAME. The default is 2 key frames per second.
COLORMAP - An M-by-3 matrix defining the colormap to be used for indexed AVI movies. M must be no greater than 256 (236 if using Indeo
compression). This parameter must be set before calling ADDFRAME, unless
you are using ADDFRAME with the MATLAB movie syntax. There is no
default colormap.
VIDEONAME - A descriptive name for the video stream. This parameter
must be no greater than 64 characters long and must be set before using
ADDFRAME. The default is the filename.
AVIFILE properties may also be set using MATLAB structure syntax. For
example, to set the Quality property to 100 use the following syntax:
aviobj = avifile(filename);
aviobj.Quality = 100;
Example:
t = linspace(0,2.5*pi,40);
fact = 10*sin(t);
fig=figure;
aviobj = avifile('example.avi')
[x,y,z] = peaks;
for k=1:length(fact)
h = surf(x,y,fact(k)*z);
axis([-3 3 -3 3 -80 80])
axis off
caxis([-90 90])
F = getframe(fig);
aviobj = addframe(aviobj,F);
end
close(fig)
aviobj = close(aviobj);
See also avifile/addframe, avifile/close, movie2avi.
Reference page in Help browser
doc avifile
Utilities
<lin2mu> - Convert linear signal to mu-law encoding.
LIN2MU Convert linear signal to mu-law encoding.
MU = LIN2MU(Y) converts linear audio signal amplitudes
in the range -1 <= Y <= 1 to mu-law encoded "flints"
in the range 0 <= MU <= 255.
See also mu2lin, auwrite for more details and references.
Reference page in Help browser
doc lin2mu
<mu2lin> - Convert mu-law encoding to linear signal.
MU2LIN Convert mu-law encoding to linear signal.
Y = MU2LIN(MU) converts mu-law encoded 8-bit audio signals,
stored as "flints" in the range 0 <= MU <= 255, to
linear signal amplitude in the range -s < Y < s where
s = 32124/32768 ~= .9803. The input MU is often obtained
using fread(...,'uchar') to read byte-encoded audio files.
"Flints" are MATLAB's integers -- floating point numbers
whose values are integers.
See also lin2mu, auread.
Reference page in Help browser
doc mu2lin
Example audio data (MAT files)
<chirp> - Frequency sweeps (1.6 sec, 8192 Hz)
CHIRP Swept-frequency cosine generator.
Y = CHIRP(T,F0,T1,F1) generates samples of a linear swept-frequency
signal at the time instances defined in array T. The instantaneous
frequency at time 0 is F0 Hertz. The instantaneous frequency F1
is achieved at time T1. By default, F0=0, T1=1, and F1=100.
Y = CHIRP(T,F0,T1,F1,method) specifies alternate sweep methods.
Available methods are 'linear','quadratic', and 'logarithmic'; the
default is 'linear'. Note that for a logarithmic-sweep, F0>=1e-6 is
required and by default F0=1e-6.
Y = CHIRP(T,F0,T1,F1,method, PHI) allows an initial phase PHI to
be specified in degrees. By default, PHI=0.
Y = CHIRP(T,FO,T1,F1,'quadratic',PHI,'concave') generates samples of
a quadratic swept-frequency signal whose spectrogram is a parabola with
its concavity in the positive frequency axis.
Y = CHIRP(T,FO,T1,F1,'quadratic',PHI,'convex') generates samples of
a quadratic swept-frequency signal whose spectrogram is a parabola with
its convexity in the positive frequency axis.
Default values are substituted for empty or omitted trailing input
arguments.
EXAMPLE 1: Compute the spectrogram of a linear chirp.
t=0:0.001:2; % 2 secs @ 1kHz sample rate
y=chirp(t,0,1,150); % Start @ DC, cross 150Hz at t=1sec
spectrogram(y,256,250,256,1E3); % Display the spectrogram
EXAMPLE 2: Compute the spectrogram of a quadratic chirp.
t=-2:0.001:2; % +/-2 secs @ 1kHz sample rate
y=chirp(t,100,1,200,'q'); % Start @ 100Hz, cross 200Hz at t=1sec
spectrogram(y,128,120,128,1E3); % Display the spectrogram
EXAMPLE 3: Compute the spectrogram of a "convex" quadratic chirp
t= 0:0.001:1; % 1 second @ 1kHz sample rate
fo=25;f1=100; % Start at 25Hz, go up to 100Hz
y=chirp(t,fo,1,f1,'q',[],'convex');
spectrogram(y,256,200,256,1000); % Display the spectrogram.
EXAMPLE 4: Compute the spectrogram of a "concave" quadratic chirp
t= 0:0.001:1; % 1 second @ 1kHz sample rate
fo=100;f1=25; % Start at 100Hz, go down to 25Hz
y=chirp(t,fo,1,f1,'q',[],'concave');
spectrogram(y,256,200,256,1000); % Display the spectrogram.
EXAMPLE 5: Compute the spectrogram of a logarithmic chirp
t= 0:0.001:10; % 10 seconds @ 1kHz sample rate
fo=10;f1=400; % Start at 10Hz, go up to 400Hz
y=chirp(t,fo,10,f1,'logarithmic');
spectrogram(y,256,200,256,1000); % Display the spectrogram.
See also gauspuls, sawtooth, sinc, square.
Reference page in Help browser
doc chirp
<gong> - Gong (5.1 sec, 8192 Hz)
gong not found.
Use the Help browser search field to search the documentation, or
type "help help" for help command options, such as help for methods.
<handel> - Hallelujah chorus (8.9 sec, 8192 Hz)
handel not found.
Use the Help browser search field to search the documentation, or
type "help help" for help command options, such as help for methods.
<laughter> - Laughter from a crowd (6.4 sec, 8192 Hz)
laughter not found.
Use the Help browser search field to search the documentation, or
type "help help" for help command options, such as help for methods.
<splat> - Chirp followed by a splat (1.2 sec, 8192 Hz)
splat not found.
Use the Help browser search field to search the documentation, or
type "help help" for help command options, such as help for methods.
<train> - Train whistle (1.5 sec, 8192 Hz)
--- help for network/train ---
TRAIN Train a neural network.
[NET,TR] = train(NET,X,T) takes a network NET, input data X
and target data T and returns the network after training it, and a
a training record TR.
[NET,TR] = train(NET,X) takes only input data, in cases where
the network's training function is unsupervised (i.e. does not require
target data).
[NET,TR] = train(NET,X,T,Xi,Ai,EW) takes additional optional
arguments suitable for training dynamic networks and training with
error weights. Xi and Ai are the initial input and layer delays states
respectively and EW defines error weights used to indicate
the relative importance of each target value.
train calls the network training function NET.trainFcn with the
parameters NET.trainParam to perform training. Training functions
may also be called directly.
train arguments can have two formats: matrices, for static
problems and networks with single inputs and outputs, and cell arrays
for multiple timesteps and networks with multiple inputs and outputs.
The matrix format is as follows:
X - RxQ matrix
Y - UxQ matrix.
Where:
Q = number of samples
R = number of elements in the network's input
U = number of elements in the network's output
The cell array format is most general:
X - NixTS cell array, each element X{i,ts} is an RixQ matrix.
Xi - NixID cell array, each element Xi{i,k} is an RixQ matrix.
Ai - NlxLD cell array, each element Ai{i,k} is an SixQ matrix.
Y - NOxTS cell array, each element Y{i,ts} is a UixQ matrix.
Xf - NixID cell array, each element Xf{i,k} is an RixQ matrix.
Af - NlxLD cell array, each element Af{i,k} is an SixQ matrix.
Where:
TS = number of time steps
Ni = NET.numInputs
Nl = NET.numLayers,
No = NET.numOutputs
ID = NET.numInputDelays
LD = NET.numLayerDelays
Ri = NET.inputs{i}.size
Si = NET.layers{i}.size
Ui = NET.outputs{i}.size
The error weights EW can be 1, indicating all targets are equally
important. It can also be either a 1xQ vector defining relative sample
importances, a 1xTS cell array of scalar values defining relative
timestep importances, an Nox1 cell array of scalar values defining
relative network output importances, or in general an NoxTS cell array
of NixQ matrices (the same size as T) defining every target element's
relative importance.
Here a static feedforward network is created, trained on some data, then
simulated using SIM and network notation.
[x,t] = simplefit_dataset;
net = feedforwardnet(10);
net = train(net,x,t);
y1 = sim(net,x)
y2 = net(x)
Here a dynamic NARX network is created, trained, and simulated on
time series data.
[X,T] = simplenarx_dataset;
net = narxnet(1:2,1:2,10);