The answer to your question depends on the specific type of model you are fitting. It is not clear from your question if you are just interested in polynomial fitting or something more complicated. For polynomials you can use the polyfit
function to get the coefficients and the polyval
function to evaluate at certain points.
%construct a test signal
x = linspace(0,1,100)';
signal = 5*x.^2 + x + 0.5;
noise = 0.1*rand(100,1);
y = signal + noise;
%Plot function
plot(x,[signal,y]);
%Polynomial fitting
n = 2; % order of polynomial
coeff = polyfit(x,y,n) % I get 5.0295, 0.9786, 0.5512
%Evaluate at a certain set of points
x1 = 2.3;
polyval(coeff,x1)
If you are fitting a more complicated model, then you will have to use cfit
to do the fitting which will give you a fit object. You have to pass that fit object to the function feval
to evaluate the function at a specific point. Check out the documentation for these functions to learn more.