Sie sind auf Seite 1von 16

Syntax

[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.

srchhyb(net,X,Pd,Tl,Ai,Q,TS,dX,gX,perf,dperf,delta,tol,ch_perf) takes these inputs,

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

1 Minimum step taken

2 Maximum step taken

3 Beta condition not met delta New initial step size, based on the current step size tol New tolerance on search

Parameters used for the hybrid bisection-cubic algorithm are

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.

Dimensions for these variables are

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

Here is a problem consisting of inputs p and targets t to be solved with a network.

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.

Create and Test a Network

net = newff([0 5],[2 1],{'tansig','logsig'},'traincgf'); a = sim(net,p)

Train and Retest the Network

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,

1. Set net.trainFcn to 'traincgf'. This sets net.trainParam to traincgf's default parameters.

2. Set net.trainParam.searchFcn to '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

Scales, L.E., Introduction to Non-Linear Optimization, New York Springer-Verlag, 1985

See Also

srchbac, srchbre, srchcha, srchgol

regulasi falsi

Find zeros of function in given interval

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])

looks for zeros only in the interval [a .. b] specified by the input.

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

This gives the following list of zeros:


z = 2.0000 2.0000 3.5000 3.5000 5.0000 6.0000

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

This gives the following list of zeros:


z = 1.0000 1.0000 2.0000 2.7000

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

Divide IQ numbers Library

tiiqmathlib in Target Support Package TC2 software Description

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

Square root or inverse square root of IQ number Library

tiiqmathlib in Target Support Package TC2 software Description

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.

Negative inputs to this block return a value of zero.

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

Whether to calculate the square root or inverse square root

Square root (_sqrt) Compute the square root. *

Inverse square root (_isqrt) Compute the inverse square root.

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

Inverse secant; result in degrees Syntax

Y = asecd(X) Description

Y = asecd(X) is the inverse secant, expressed in degrees, of the elements of X. sech

Hyperbolic secant Syntax

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

Graph the hyperbolic secant over the domain

x = -2*pi:0.01:2*pi; plot(x,sech(x)), grid on

Algorithm

sech uses this algorithm.

Definition

The secant can be defined as

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

Inverse hyperbolic secant Syntax

Y = asech(X) Description

Y = asech(X) returns the inverse hyperbolic secant for each element of X.

The asech function operates element-wise on arrays. The function's domains and ranges include complex values. All angles are in radians. Examples

Graph the inverse hyperbolic secant over the domain .

x = 0.01:0.001:1; plot(x,asech(x)), grid on

Definition

The hyperbolic inverse secant can be defined as

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

Inverse secant; result in radians Syntax

Y = asec(X) Description

Y = asec(X) returns the inverse secant (arcsecant) for each element of X.

The asec function operates element-wise on arrays. The function's domains and ranges include complex values. All angles are in radians. Examples

Graph the inverse secant over the domains and .

x1 = -5:0.01:-1; x2 = 1:0.01:5; plot(x1,asec(x1),x2,asec(x2)), grid on

Definition

The inverse secant can be defined as

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

Secant of argument in degrees Syntax

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

sec, sech, asec, asecd, asech sec

Secant of argument in radians Syntax

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

Graph the secant over the domains and .

x1 = -pi/2+0.01:0.01:pi/2-0.01; x2 = pi/2+0.01:0.01:(3*pi/2)-0.01; plot(x1,sec(x1),x2,sec(x2)), grid on

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

The secant can be defined as

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.

Das könnte Ihnen auch gefallen