Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Any function in MATLAB to define function from sample values

Status
Not open for further replies.

gunturikishore

Full Member level 2
Full Member level 2
Joined
Aug 19, 2004
Messages
146
Helped
13
Reputation
26
Reaction score
6
Trophy points
1,298
Location
INDIA GANDHINAGAR
Activity points
1,363
Hi,

Is there any such function that provides a mathematical function in MATLAB when the sample vaues are given in numericals. Thanks for any help in advance.
 

Re: Any function in MATLAB to define function from sample va

Have you looked at the interpolation functions?
 

Re: Any function in MATLAB to define function from sample va

It depends on the problem you are going to solve.

1) If you intend just to apply any function (according to a certain criterion) in order to link the all the knots (all samples) then interpolation should be used. Matlab provides you with polynomials of various degrees (i's unlikely to choose too high degrees because of the too much time expenditure), splines, shape-preserving interpolation and special functions, available in Matlab's description.

2) If you need to find out the function that fits the data, but at the same time doesn't connect all the knots choose approximation techniques, for example polynomial approximation with RMS criterion - function polyfit

With respect.

Dmitrij
 

Re: Any function in MATLAB to define function from sample va

gunturikishore said:
Hi,

Is there any such function that provides a mathematical function in MATLAB when the sample vaues are given in numericals. Thanks for any help in advance.


If you simply need to "connect the dots", try using MATLAB's built-in spline functions, such as interp1, pchip and spline.

If you need to fit a model to your data (a least-squares curve-fit, for instance, which won't necessarily pass through any of the given data points), then things are more complicated. A simple, least-squares linear fit can be accomplished via MATLAB's backslash operator, '\'. See, for instance: https://matlabdatamining.blogspot.com/2007/04/linear-regression-in-matlab.html

Some nonlinear models can be achieved by simply adding nonlinear terms to a linear fit (fit versus a constant, x and log of x, rather than just x). Polynomial fits can be performed by using MATLAB's polyfit function.


-Will Dwinnell
https://matlabdatamining.blogspot.com/
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top