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 =)
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.
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.
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.
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 .
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)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With