Nonlinear regression analysis of a vector

I'm trying to get a nonlinear fit of a vector in Matlab with no success.

Let's assume that I have a vector called data:

data = [1,30,250,55,22,76]


which can be seen as a function like

f(0)=data[0]
f(1)=data[1]


and so on.

This is how it looks on WolframAlpha

I want to make a nonlinear regression of this function/array with Matlab but the documentation is not helping me as it says something about DataSet or Matrix and I don't know how to get there starting from my simple array.

So the question is:

how can I make a nonlinear regression, in Matlab, starting from a given vector that can be seen as a function?

EDIT: As an extra, is it possible to have an array containing all the residuals in this form?

residuals[0]=residual of data[0]


EDIT 2: The output should be a function like this WolframAlpha result

-

Create x data values

 x_data=[1 2 3 4 5 6]';


Create y data values

y_data=[1 30 250 55 22 76]';


Create custom fit function

g = fittype( @(a, b, c, d, e, x) a*x.^4+b*x.^3+c*x.^2+d*x+e );


Fit the data

[cfun,gof,output] = fit( x_data, y_data, g );


Display the coefficients

cfun


Display the residuals

output.residuals

-