Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Having used FindFit like so:

x = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
y = {17, 14, 11, 11, 10, 10, 9, 9, 9, 9};
data = Transpose[{x, y}];

model = a Zeta[b n + c]
fit = FindFit[data, model, {a, b, c}, n]
modelf = Function[{n}, Evaluate[model /. fit]]

Plot[modelf[x], {x, 0, 11}, Epilog -> Map[Point, data], PlotRange -> 
{{0, 11}, {0, 50}}, AspectRatio -> Automatic]

with a relatively small data set, I took the average a, b & c (which were all very close) (n clearly followed a linear trend) & came up with a step function that plotted the following against the original data points:

enter image description here

Plotted with:

x = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
y = {17, 14, 11, 11, 10, 10, 9, 9, 9, 9};
data = Transpose[{x, y}];
n = 10;
ListLinePlot[Round[Table[
(n - 1) Zeta[(Cos[1/2] + Sin[1/2]) + (Cos[1/2] - Sin[1/2]) (x)], {x, 0, 20}], 1],  
InterpolationOrder -> 0, PlotRange -> {{1, 12}, {0, 70}}, Frame -> True, 
AspectRatio -> Automatic, Filling -> Bottom, ImageSize -> 100, 
Epilog -> {PointSize[Medium], Red, Point[data]}]

Is there any way I can improve the accuracy of these plots? Do I have any hope of finding the exact step function, or am I being a little optimistic?

Original data set:

x = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11};

where x is the same for all

y = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
y = {2, 1, 1, 1, 1, 1, 1, 1, 1, 1};
y = {4, 3, 2, 2, 2, 2, 2, 2, 2, 2};
y = {6, 5, 4, 3, 3, 3, 3, 3, 3, 3};
y = {7, 6, 5, 5, 4, 4, 4, 4, 4, 4};
y = {8, 7, 7, 6, 5, 5, 5, 5, 5, 5};
y = {12, 8, 8, 7, 7, 6, 6, 6, 6, 6};
y = {13, 10, 9, 8, 8, 7, 7, 7, 7, 7};
y = {15, 13, 10, 10, 9, 8, 8, 8, 8, 8};
y = {17, 14, 11, 11, 10, 10, 9, 9, 9, 9};
y = {18, 15, 13, 12, 11, 11, 10, 10, 10, 10};
y = {20, 16, 14, 13, 13, 12, 11, 11, 11, 11};
y = {23, 18, 15, 14, 14, 13, 12, 12, 12, 12};
share|improve this question
    
If you need step functions for your data sets, why don’t you work with Piecewise (see manual)? –  partial81 Dec 5 '13 at 20:47
    
I have reason to believe that a smooth function has generated the above data –  martin Dec 5 '13 at 20:49
    
Do you have only 10 points for each sequence? –  belisarius Dec 5 '13 at 22:22
    
yes - all the other points to the right of x=10 are the same. This doesn't change until n= about 50. –  martin Dec 6 '13 at 4:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.