Info

This question is closed. Reopen it to edit or answer.

how do i convert a given set of values into a function?

1 view (last 30 days)
I have sampled the current waveform coming from the supply and i obtained a set of discrete values. How do i generate the function of the waveform i sampled?

Answers (2)

Azzi Abdelmalek
Azzi Abdelmalek on 10 Nov 2013
Edited: Azzi Abdelmalek on 10 Nov 2013
Use fit function, but you will need a curve fiting toolbox. But before finding a function that represent your data, you should take a look at them and choose which function could match.
  1 Comment
Image Analyst
Image Analyst on 11 Nov 2013
Swathi's "Answer" moved here:
But doesn't the fit function give me only the plot of my data? I want the equation of the plotted curve. Is that possible using matlab?

Image Analyst
Image Analyst on 11 Nov 2013
There are many many functions that could give you that function. For example (an extreme case) the "Lagrange interpolating polynomial."
If you want a simpler fit, try polyfit(). Since you didn't post a screenshot of your plot, we can't even begin to guess what your data looks like. Do you have any underlying theory? Like it should be a sine wave or something?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!