72078

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

Question:

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 <a href="http://www.mathworks.se/help/curvefit/fit.html" rel="nofollow">http://www.mathworks.se/help/curvefit/fit.html</a>

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

Thanks =)

Answer1:

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 <a href="http://octave.sourceforge.net/optim/index.html" rel="nofollow">optim package</a>, probably the function <a href="http://octave.sourceforge.net/optim/function/nonlin_curvefit.html" rel="nofollow">nonlin_curvefit</a>. 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).

Answer2:

A work-around may be using "polyfit" function. To get the values, use "polyval".

Recommend

  • ASP.NET MVC Routing question
  • What is the read/write cost for Firestore docRef.Collections(ctx)?
  • Calculating rates in PostgreSQL
  • XAMLX Workflow with c# expressions
  • Creating an unordered_map of std::functions with any arguments?
  • Building Lua for C++
  • Check if PCollection is empty - Apache Beam
  • Bootstrap multi select grouping dynamicaly using array
  • How to use apoc.load.csv in conjunction with apoc.create.node
  • Firebase Notification not working in background
  • exception thrown while building the java application using netbeans
  • Create a log file for a custom DNN module
  • Project Euler -Prob. #20 (Lua)
  • can I build CMakeLists.txt from a set of smaller files (to improve the readability and maintainabili
  • Can I switch the 'connected' user within an sql script that is sourced by mysql?
  • iOS App crashed com.apple.root.background-qos
  • How to create OLE Automation to be used with ClearExplorer
  • Write to elasticsearch from spark is very slow
  • I need a PHP mySQL Login script that directs user to specific URL based on username and password
  • How to get “crispEdges” for SVG text?
  • Showing image on a acro text field position
  • Sample deviceQuery cuda program
  • select an input by value?
  • Ember.js + JQuery-UI Tooltip - Tooltip does not reflect the model / controller changes
  • trigger ontouch event programmatically
  • Change the color of the legend text in forceNetwork for networkD3
  • When to use the tag in the head and body section of a html page? [duplicate]
  • Annotate objects in a queryset with next and previous object ids
  • Create an average of multiple excel chart without the data source
  • How to split wav file into two or more parts using c#
  • Content-Type alternative in MQTT
  • How to call jQuery function in HTML returned by AJAX
  • Android: Unable to detect vertical plane
  • Debug `Unexpected end of JSON input Error` on content script
  • How to encrypt Connectionstring written in web.config from codebehind?
  • Call Microservice from another Microservice within Docker