{"id":624,"date":"2012-03-02T12:37:02","date_gmt":"2012-03-02T17:37:02","guid":{"rendered":"https:\/\/blogs.mathworks.com\/videos\/?p=624"},"modified":"2012-03-02T12:37:02","modified_gmt":"2012-03-02T17:37:02","slug":"piecewise-linear-curve-fitting","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/videos\/2012\/03\/02\/piecewise-linear-curve-fitting\/","title":{"rendered":"Piecewise linear curve fitting"},"content":{"rendered":"This week, I am getting back to my blogging roots and I want to highlight (and thank) <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/679\">John D&#8217;errico<\/a> for a great file Exchange submission.  That file is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/24443-slm-shape-language-modeling\">Shape Language Modeling<\/a>.\r\n\r\n<p>\r\n<p>\r\n\r\nRecently I had some very noisy data that I wanted to fit a curve to.  The problem is there were different regions that were somewhat linear, but the overall data was far from linear.  A spline or a  polynomial did not capture the behavior in a global sense.  What I wanted was the ability to fit a line to each region.  SLM does that right out of the box.\r\n\r\n<a href=\"https:\/\/blogs.mathworks.com\/videos\/files\/2012\/03\/linModel.jpg\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/videos\/files\/2012\/03\/linModel.jpg\" alt=\"\" title=\"linModel\" width=\"600\" class=\"aligncenter size-full wp-image-625\" \/><\/a>\r\n\r\n<p>\r\n\r\nI think it is very instructive to look at how this code was packaged up.  There is a clearly labeled tutorial that was easy to scan looking for an example like what I wanted to do.  All of the files have lots of comments.  sometimes more comments that code I think.  The files are named coherently so they make a nice package.  These are all great things to make a package that other people can use.","protected":false},"excerpt":{"rendered":"<p>This week, I am getting back to my blogging roots and I want to highlight (and thank) John D&#8217;errico for a great file Exchange submission.  That file is Shape Language&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/videos\/2012\/03\/02\/piecewise-linear-curve-fitting\/\">read more >><\/a><\/p>","protected":false},"author":68,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts\/624"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/users\/68"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/comments?post=624"}],"version-history":[{"count":10,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts\/624\/revisions"}],"predecessor-version":[{"id":635,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts\/624\/revisions\/635"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/media?parent=624"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/categories?post=624"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/tags?post=624"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}