Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a GNU Octave equivalent for the Matlab function "fit"?

My teacher in the signal analysis course has given me some Matlab code that I have to execute in order to complete a home assignment. I have always been using GNU Octave without troubles, but this time there is this command that is giving me headaches.

[c8,g8]=fit(time, sin_4_harmonic,’fourier8’)

I cannot find the function "fit" in GNU Octave, which is referenced for Matlab at the following url http://www.mathworks.se/help/curvefit/fit.html

Does anyone knows which package should I load, or if there is any equivalent?

Thanks =)

like image 332
wizclown Avatar asked Nov 11 '13 17:11

wizclown


People also ask

Is GNU Octave compatible with MATLAB?

Octave is mostly compatible with Matlab. Most matlab functions can be made to run with very little change. With careful coding, you can get your code to run without change in Matlab and Octave.

Is Octave an alternative to MATLAB?

GNU Octave may be the best-known alternative to MATLAB. In active development for almost three decades, Octave runs on Linux, Windows, and Mac—and is packaged for most major distributions.

How do you fit a graph into Octave?

When plotting in Octave you plot points having their x -values stored in one vector and the y -values in another vector. The two vectors must be the same size. Octave inserts lines between the points. If you want a smoother graph, make a longer x -vector.

How do I write an Octave code in MATLAB?

Simply type the filename without extension . Type run("filename. m") in the command line of Octave . Then press ctrl + c to exit the file in middle of the run .


1 Answers

As far as I know, that function is not present in any of the Octave packages. However, the best place to look for something similar would be the optim package, probably the function nonlin_curvefit. Looking at the documentation, the model fourier8 is of the type Y = a0+a1*cos(x*p)+b1*sin(x*p)... +a8*cos(8*x*p)+b8*sin(8*x*p).

like image 157
carandraug Avatar answered Oct 18 '22 08:10

carandraug