In other words, dividing
x by each element of
div leaves as remainder the corresponding element of
also specifies the tolerance. In practice, there may be no value that satisfies all
x = coincidence(
div exactly. In that case,
coincidence identifies a set of candidates that approximately satisfy
the constraints and are within an interval of width 2 ×
tol centered at the candidates' median. The function then returns the median
Find a number smaller than
1000 that has a remainder of
2 when divided by
9, a remainder of
3 when divided by
10.4, and a remainder of
6.3 when divided by
There is no number that satisfies the constraints exactly, so specify a tolerance of
coincidence identifies a set of numbers that approximately satisfy the constraints and are within from their median. The function then outputs the median.
tol = 1; x = coincidence([2 3 6.3],[9 10.4 11],1000,tol)
x = 127.8000
Increase the tolerance to
tol = 2; x = coincidence([2 3 6.3],[9 10.4 11],1000,tol)
x = 74
Specify a tolerance of
3.3. Any tolerance larger than this value results in the same answer.
tol = 3.3; x = coincidence([2 3 6.3],[9 10.4 11],1000,tol)
x = 3
In a staggered pulse repetition frequency (PRF) radar system, the first PRF corresponds to
70 range bins and the second PRF corresponds to
85 range bins. The target is detected at bin
47 for the first PRF and bin
12 for the second PRF. Assuming each range bin is
50 meters, compute the target range from these two measurements. Assume the farthest target can be
50 km away.
idx = coincidence([47 12],[70 85],50e3/50); r = 50*idx
r = 30350
res— Remainder array
Remainder array, specified as a row vector of nonnegative numbers.
res must have the same number of elements as
div— Divisor array
Divisor array, specified as a row vector of positive integers.
have the same number of elements as
maxval— Upper bound
Upper bound, specified as a positive scalar.
0(default) | nonnegative scalar
Tolerance, specified as a nonnegative scalar.
x— Congruent value
Congruent value, returned as a scalar.