What can we do in the case where different units are used for the measurements of each axis and the quantities differ considerably in magnitude? A simple solution is to change the scale of the axes by dividing the difference from the mean for each point by the maximum difference for the axis. This results in sets of dimensionless values that vary between -1 and 1 for each axis. We can test this procedure by generating the data points, r

^{<k>}, of a line and add small random variations δr

^{<k>}. The function

*rnorm*below generates a set of n random numbers with a normal distribution about the mean μ=0 and with standard deviation σ=0.01 and the function

*runif*generates a set of n random numbers with a uniform distribution between 0 and 2π. Notice that the slope of the line was arbitrarily chosen to be 30 degrees.

The next step is to determine the differences of the points from the mean value for each axis and rescale each axis by dividing it by the maximum difference. The rescaled data points can be used to solve for the fit with minimum error.

Since the rescaled axes vary between the same limits the angle of the line is approximately 45 degrees. When one converts back to the original scales by multiplying by the maximum differences for each axis the fit is very close to the arbitrarily chosen 30 degrees. The rms deviation is slightly less than the standard deviation since only the normal deviations from the line are used.

We can plot the rescaled data points with the fitted line to check the fit.

## No comments:

Post a Comment