CurveFit Function

Compares two vectors and returns a normalised difference value. If the vectors are identical, the function returns 0. If one is the exact negative of the other the function returns 1.0. The function is designed to be used for curve fit optimisation. The function is tolerant of vectors with different x-values. If the two vectors do not have coincident end-points, the result will be calculated over the span which overlaps. The function will return empty if there is no overlap.

The function expects both vectors to be X-Y vectors. That is they contain x-values. This is always the case for simulation vectors. For example the vectors generated by a DC sweep simulation have x-values representing the swept parameter. Vectors created by a transient analysis have x-values representing time.

The function will return an empty vector if either vector has no x-values. The XY function can be used to create an X-Y vector from simple vectors.

Arguments

 Number Type Compulsory Default Description 1 Real array Yes Vector 1 for comparison 2 Real array Yes Vector 2 for comparison

Argument 1

Vector 1 for comparison

Argument 2

Vector 1 for comparison

Returns

Return type: Real

Scalar value indicating the difference between the two vectors. 0 means they are identical over their overlapping range. 1.0 means they are equal and opposite