Search code examples
matlabmaple

Matlab Vs. Maple for curve fitting to data, finding eq'n of curve then integrating through code


Im sure there are a thousand different posts on Maple vs Matlab, but i have a bit of a unique set of requirements and before i go off to learn one of the two i would like to know which one will do it best.

I have a set of data from an accelerometer recording an impact. I need to do the following:

  1. fit a curve to the data
  2. Find the equation for that curve
  3. solve the equation listed at the link http://upload.wikimedia.org/wikipedia/en/math/2/d/3/2d39556df1dbbd467dc914253e93cdb0.png which solves for a family of curves,i.e the MAX under the interval.

I would like to do this as seamlessly with visual studio as possible. The GUI and all the other elements of the app are built in VB and I would like to keep it there. I know maple has a code generating part to it that will convert to VB, would it be able to handle something like this? Does Matlab integrate with Visual Studio well? I would be thrilled if there was an object i could place on the VB form which would facilitate the communication to and from the matlab or maple framework. Currently i have it working with R, however to do so i need to write the data to a file, launch the R script, wait for it to finish, return control to my VB app and take it from there. This process takes too long and since i do not have experience with multi threaded programming the GUI freezes up when control is passed to the script.

Any help or suggestions would be very much appreciated!


Solution

  • MATLAB doesn't auto-generate VB code, but it can easily be called from a VB application without the indirection of writing a file. It has COM interface that can be called directly from within VB code. See this example from the MATLAB documentation to find out more.

    To carry out the technical analysis you've mentioned, you would probably save time by using Curve Fitting Toolbox in addition to base MATLAB.

    Note that the above method of connecting to MATLAB via its COM interface relies on there being a live copy of MATLAB present when the VB application is executed. If you need to share your application with people who don't have a copy of MATLAB, you can also create standalone COM components and .NET assemblies from MATLAB code that can be called in the same way by your VB code, but can be deployed freely to people without a MATLAB license - however, this requires an extra product, MATLAB Builder for .NET.