From: Bruno Luong on 2 Jun 2010 17:22 You might take a look at this tool that places automatically small number of knot points and still well preserve the shape of your function: http://www.mathworks.com/matlabcentral/fileexchange/25872-free-knot-spline-approximation Bruno
From: Walter Roberson on 2 Jun 2010 17:29 Charles wrote: > The thing is that I do not quite know the exact shape of the curves, i.e > where the minimum and maximum values lie. I will want a function that > resamples say 1/3rd at the min, 1/3rd at the middle, and 1/3rd at the > maximum areas of the function. The curve is shaped like a sigmoid. Matlab knows even less than you do about the exact shape of the curve. If you were able to present the equation of the curve symbolically, then you could take the derivative of the formula and attempt to find the roots of the derivatives, using the classic calculus formula that the minima and maxima and inflection points of a curve occur where the roots are 0. If all you have for the curve is some finitely sampled data and you have no formula (even one with unknown parameters) for the curve, then it is not possible to calculate where the minima and maxima are, and thus not possible to sample the curve near those points. Unless, that is, by "min" and "maximum area" you are referring to the left and right sides of the interval. If that's what you need, then you can use something like W = linspace(0, 1, N/3); T = W.^2; V = (b-a)/3; newx = [a + V .* T, a + V .* (1 + W), a + V .* (2 + fliplr(T))]; This packs the samples most densely at the left and right edge and linearly in the middle. It assumes that N is a multiple of 3. Looking at this again, I see it has a slight flaw, in that it will duplicate the points that are exactly 1/3 and 2/3 of the way through the range, because each of the subsets W and T span the entire interval 0 to 1. I'll leave that to you to decide how to fix.
First
|
Prev
|
Pages: 1 2 Prev: How to plot two grashs on single figure? Next: 2D Gaussian Multipeak Fitting |