MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayMATLAB Central > MATLAB Newsreader > Best fit line with constrained coefficients 

Subject: Best fit line with constrained coefficients From: Nathan Date: 10 May, 2010 20:13:08 Message: 1 of 13 
I am trying to fit a line to my data points, and while polyfit and regstats will easily fit a line, it may not be physically relevant. How do I edit these functions so they will fit a regression line with a positive slope. 
Subject: Best fit line with constrained coefficients From: Matt J Date: 10 May, 2010 20:43:10 Message: 2 of 13 
"Nathan " <ndn3@georgetown.edu.remove.this> wrote in message <hs9pck$618$1@fred.mathworks.com>... 
Subject: Best fit line with constrained coefficients From: Nathan Date: 10 May, 2010 23:22:24 Message: 3 of 13 
I should have been more specific. While m and b are important, I'd also like to get the MSE, p, and r values for the fit. Ideally, I was looking for a model option for regstats that let me add constraints to the coefficients. Something like regstats(X,Y,[>0]). 
Subject: Best fit line with constrained coefficients From: Roger Stafford Date: 10 May, 2010 23:30:27 Message: 4 of 13 
"Nathan " <ndn3@georgetown.edu.remove.this> wrote in message <hs9pck$618$1@fred.mathworks.com>... 
Subject: Best fit line with constrained coefficients From: Matt J Date: 11 May, 2010 14:37:04 Message: 5 of 13 
"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <hsa4uj$6mv$1@fred.mathworks.com>... 
Subject: Best fit line with constrained coefficients From: Matt J Date: 11 May, 2010 14:50:19 Message: 6 of 13 
"Nathan " <ndn3@georgetown.edu.remove.this> wrote in message <hsa4fg$7fv$1@fred.mathworks.com>... 
Subject: Best fit line with constrained coefficients From: Nathan Date: 11 May, 2010 15:12:06 Message: 7 of 13 
Is there a way to use orthogonal offsets instead of vertical offsets when doing the least squares fitting? I think that may be more of what I am envisioning. 
Subject: Best fit line with constrained coefficients From: Bruno Luong Date: 11 May, 2010 15:35:06 Message: 8 of 13 
"Nathan " <ndn3@georgetown.edu.remove.this> wrote in message <hsbs46$q21$1@fred.mathworks.com>... 
Subject: Best fit line with constrained coefficients From: Matt J Date: 11 May, 2010 16:37:04 Message: 9 of 13 
"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <hsbq2g$be5$1@fred.mathworks.com>... 
Subject: Best fit line with constrained coefficients From: Roger Stafford Date: 11 May, 2010 19:23:05 Message: 10 of 13 
"Nathan " <ndn3@georgetown.edu.remove.this> wrote in message <hsbs46$q21$1@fred.mathworks.com>... 
Subject: Best fit line with constrained coefficients From: Bruno Luong Date: 11 May, 2010 19:36:04 Message: 11 of 13 
"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <hscaqo$g36$1@fred.mathworks.com>... 
Subject: Best fit line with constrained coefficients From: Roger Stafford Date: 11 May, 2010 20:02:06 Message: 12 of 13 
"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <hscbj4$49m$1@fred.mathworks.com>... 
Subject: Best fit line with constrained coefficients From: Matt J Date: 11 May, 2010 20:49:04 Message: 13 of 13 
"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <hscaqo$g36$1@fred.mathworks.com>... 
No tags are associated with this thread.
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.