Beruflich Dokumente
Kultur Dokumente
[a,gX,perf,retcode,delta,tol] = srchhyb(net,X,Pd,Tl,Ai,Q,TS,dX,gX,perf,dperf,delta,tol,ch_perf)
Description
srchhyb is a linear search routine. It searches in a given direction to locate the minimum of the performance function in that direction. It uses a technique that is a combination of a bisection and a cubic interpolation.
net Neural network X Vector containing current values of weights and biases Pd Delayed input vectors Tl Layer target vectors Ai Initial input delay conditions Q Batch size TS
Time steps dX Search direction vector gX Gradient vector perf Performance value at current X dperf Slope of performance value at current X in direction of dX delta Initial step size tol Tolerance on search ch_perf Change in performance on previous step
and returns
a Step size that minimizes performance gX Gradient at new minimum point perf Performance value at new minimum point retcode Return code that has three elements. The first two elements correspond to the number of function evaluations in the two stages of the search. The third element is a return code. These have different meanings for different search algorithms. Some might not be used in this function.
0 Normal
3 Beta condition not met delta New initial step size, based on the current step size tol New tolerance on search
alpha Scale factor that determines sufficient reduction in perf beta Scale factor that determines sufficiently large step size bmax Largest step size scale_tol Parameter that relates the tolerance tol to the initial step size delta, usually set to 20
The defaults for these parameters are set in the training function that calls them. See traincgf, traincgb, traincgp, trainbfg, and trainoss.
Pd No x Ni x TS cell array Each element P{i,j,ts} is a Dij x Q matrix. Tl Nl x TS cell array Each element P{i,ts} is a Vi x Q matrix. Ai Nl x LD cell array Each element Ai{i,k} is an Si x Q matrix.
where
Ni =
net.numInputs Nl =
net.numLayers LD =
net.numLayerDelays Ri =
net.inputs{i}.size Si =
net.layers{i}.size Vi =
net.targets{i}.size Dij =
Ri * length(net.inputWeights{i,j}.delays)
Examples
p = [0 1 2 3 4 5]; t = [0 0 0 1 1 1];
A two-layer feed-forward network is created. The network's input ranges from [0 to 10]. The first layer has two tansig neurons, and the second layer has one logsig neuron. The traincgf network training function and the srchhyb search function are to be used.
net.trainParam.searchFcn = 'srchhyb'; net.trainParam.epochs = 50; net.trainParam.show = 10; net.trainParam.goal = 0.1; net = train(net,p,t); a = sim(net,p)
Network Use
You can create a standard network that uses srchhyb with newff, newcf, or newelm.
To prepare a custom network to be trained with traincgf, using the line search function srchhyb,
The srchhyb function can be used with any of the following training functions: traincgf, traincgb, traincgp, trainbfg, trainoss.
Algorithm
srchhyb locates the minimum of the performance function in the search direction dX, using the hybrid bisection-cubic interpolation algorithm described on page 50 of Scales (see reference below).
Reference
See Also
regulasi falsi
Syntax
z = fnzeros(f) z = fnzeros(f,[a b])
Description
z = fnzeros(f)
provides the 2-rowed matrix z that is an ordered list of the zeros of the continuous univariate spline in f in its basic interval.
z = fnzeros(f,[a b])
Each column z(:,j) contains the left and right endpoint of an interval. These intervals are of three kinds:
If the endpoints agree, then the function in f is relatively small at that point. If the endpoints agree to many significant digits, then the function changes sign across the interval, and the interval contains a zero of the function -- provided the function is continuous there. If the endpoints are not close, then the function is zero on the entire interval.
Examples
Example 1. We construct and plot a piecewise linear spline that has each of the three kinds of zeros, use fnzeros to compute all its zeros, and then mark the results on that graph.
sp = spmak(augknt(1:7,2),[1,0,1,-1,0,0,1]); fnplt(sp) z = fnzeros(sp) nz = size(z,2); hold on plot(z(1,:),zeros(1,nz),'>',z(2,:),zeros(1,nz),'<'), hold off
In this simple example, even for the second kind of zero, the two endpoints agree to all places.
Example 2. We generate a spline function with many extrema and locate all that are in a certain interval by computing the zeros of the spline function's first derivative there.
rand('seed',23) sp = spmak(1:21,rand(1,16)-.5); fnplt(sp) z = mean(fnzeros(fnder(sp),[7,14])); zy = fnval(sp,z); hold on, plot(z,zy,'o'), hold off
Example 3. We construct a spline with a zero at a jump discontinuity and in B-form and find all the spline's zeros in an interval that goes beyond its basic interval.
sp = spmak([0 0 1 1 2],[1 0 -.2]); fnplt(sp) z = fnzeros(sp,[.5, 2.7]) zy = zeros(1,size(z,2)); hold on, plot(z(1,:),zy,'>',z(2,:),zy,'<'), hold off
Notice the resulting zero interval [2..2.7], due to the fact that, by definition, a spline in Bform is identically zero outside its basic interval.
Algorithm
fnzeros
first converts the function to B-form. It locates zero intervals by the corresponding sequence of consecutive zero B-spline coefficients. It locates the sign changes in the B-spline coefficients for the function, isolates them from each other by suitable knot insertion, and then uses the Modified Regula falsi to locate the corresponding sign changes in the function, if any.
See Also
fnmin, fnval
Cautionary Note
fnzeros
may not work correctly for discontinuous functions. For example, for the discontinuous piecewise linear function provided by
sp = spmak([0 0 1 1 2 2],[-1 1 -1 1]), fnzeros(sp)
will only find the zero in (1..2), but not the zero in (0..1) nor the jump through zero at 1.
Newton rhapson Division IQN
This block divides two numbers that use the same Q format, using the Newton-Raphson technique. The resulting quotient uses the same Q format at the inputs.
Note The implementation of this block does not call the corresponding Texas Instruments library function during code generation. The TI function uses a global Q setting and the MathWorks code used by this block dynamically adjusts the Q format based on the block input. See About the IQmath Library for more information.
Dialog Box
See Also
Absolute IQN, Arctangent IQN, Float to IQN, Fractional part IQN, Fractional part IQN x int32, Integer part IQN, Integer part IQN x int32, IQN to Float, IQN x int32, IQN x IQN, IQN1 to IQN2, IQN1 x IQN2, Magnitude IQN, Saturate IQN, Square Root IQN, Trig Fcn IQN Square Root IQN
This block calculates the square root or inverse square root of an IQ number and returns an IQ number of the same Q format. The block uses table lookup and a Newton-Raphson approximation.
Note The implementation of this block does not call the corresponding Texas Instruments library function during code generation. The TI function uses a global Q setting and the MathWorks code used by this block dynamically adjusts the Q format based on the block input. See About the IQmath Library for more information.
Dialog Box
Function
See Also
Absolute IQN, Arctangent IQN, Division IQN, Float to IQN, Fractional part IQN, Fractional part IQN x int32, Integer part IQN, Integer part IQN x int32, IQN to Float, IQN x int32, IQN x IQN, IQN1 to IQN2, IQN1 x IQN2, Magnitude IQN, Saturate IQN, Trig Fcn IQN Metode secant asecd
Y = asecd(X) Description
Y = sech(X) Description
The sech function operates element-wise on arrays. The function's domains and ranges include complex values. All angles are in radians.
Y = sech(X) returns an array the same size as X containing the hyperbolic secant of the elements of X. Examples
Algorithm
Definition
Algorithm
sec uses FDLIBM, which was developed at SunSoft, a Sun Microsystems, Inc. business, by Kwok C. Ng, and others. For information about FDLIBM, see http://www.netlib.org. asech
Y = asech(X) Description
The asech function operates element-wise on arrays. The function's domains and ranges include complex values. All angles are in radians. Examples
Definition
Algorithm
asech uses FDLIBM, which was developed at SunSoft, a Sun Microsystems business, by Kwok C. Ng, and others. For information about FDLIBM, see http://www.netlib.org. asec
Y = asec(X) Description
The asec function operates element-wise on arrays. The function's domains and ranges include complex values. All angles are in radians. Examples
Definition
Algorithm
asec uses FDLIBM, which was developed at SunSoft, a Sun Microsystems business, by Kwok C. Ng, and others. For information about FDLIBM, see http://www.netlib.org. secd
Y = secd(X) Description
Y = secd(X) is the secant of the elements of X, expressed in degrees. For odd integers n, secd(n*90) is infinite, whereas sec(n*pi/2) is large but finite, reflecting the accuracy of the floating point value of pi. See Also
Y = sec(X) Description
The sec function operates element-wise on arrays. The function's domains and ranges include complex values. All angles are in radians.
Y = sec(X) returns an array the same size as X containing the secant of the elements of X. Examples
The expression sec(pi/2) does not evaluate as infinite but as the reciprocal of the floating-point accuracy eps, because pi is a floating-point approximation to the exact value of . Definition
Algorithm
sec uses FDLIBM, which was developed at SunSoft, a Sun Microsystems, Inc. business, by Kwok C. Ng, and others. For information about FDLIBM, see http://www.netlib.org.