Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
lsqlin

Subject: lsqlin

From: Paul

Date: 17 Mar, 2009 16:45:04

Message: 1 of 4

Hi,

I'm not very familiar with setting up constraints in lsqlin but I was wondering how do write equality constraints so that only some of the regressors are affected e.g. if I have x1, x2, x3 and x4 and I want x1 to take any value but x2+x3+x4=1. How can I write this using the form Aeq*x=beq.

Any help much appreciated,
Paul

Subject: lsqlin

From: Steven Lord

Date: 17 Mar, 2009 16:55:12

Message: 2 of 4


"Paul " <paul.murray@pioneerinvestmentsremovethissection.com> wrote in
message news:gpok2g$6jb$1@fred.mathworks.com...
> Hi,
>
> I'm not very familiar with setting up constraints in lsqlin but I was
> wondering how do write equality constraints so that only some of the
> regressors are affected e.g. if I have x1, x2, x3 and x4 and I want x1 to
> take any value but x2+x3+x4=1. How can I write this using the form
> Aeq*x=beq.
>
> Any help much appreciated,
> Paul

The constraint x2+x3+x4 = 1 is equivalent to the constraint 0*x1 + 1*x2 +
1*x3 + 1*x4 = 1 if you assume that x1 must be finite, which is a reasonable
assumption when using LSQLIN. Can you convert this new constraint into the
form Aeq*x = beq?

--
Steve Lord
slord@mathworks.com

Subject: lsqlin

From: Paul

Date: 17 Mar, 2009 17:21:01

Message: 3 of 4

"Steven Lord" <slord@mathworks.com> wrote in message <gpokl6$6ca$1@fred.mathworks.com>...
>
> "Paul " <paul.murray@pioneerinvestmentsremovethissection.com> wrote in
> message news:gpok2g$6jb$1@fred.mathworks.com...
> > Hi,
> >
> > I'm not very familiar with setting up constraints in lsqlin but I was
> > wondering how do write equality constraints so that only some of the
> > regressors are affected e.g. if I have x1, x2, x3 and x4 and I want x1 to
> > take any value but x2+x3+x4=1. How can I write this using the form
> > Aeq*x=beq.
> >
> > Any help much appreciated,
> > Paul
>
> The constraint x2+x3+x4 = 1 is equivalent to the constraint 0*x1 + 1*x2 +
> 1*x3 + 1*x4 = 1 if you assume that x1 must be finite, which is a reasonable
> assumption when using LSQLIN. Can you convert this new constraint into the
> form Aeq*x = beq?
>
> --
> Steve Lord
> slord@mathworks.com
>

Thanks Steve. I probably should have expanded: I'm trying to run a constrainted dummy variable regression with 3 unconstrained regressors and two dummy blocks consisting of 10 columns each. The 1st & 2nd dummy blocks should add up to 1 respectively.

Paul

Subject: lsqlin

From: Steven Lord

Date: 17 Mar, 2009 17:31:34

Message: 4 of 4


"Paul " <paul.murray@pioneerinvestmentsremovethissection.com> wrote in
message news:gpom5t$mml$1@fred.mathworks.com...
> "Steven Lord" <slord@mathworks.com> wrote in message
> <gpokl6$6ca$1@fred.mathworks.com>...
>>
>> "Paul " <paul.murray@pioneerinvestmentsremovethissection.com> wrote in
>> message news:gpok2g$6jb$1@fred.mathworks.com...
>> > Hi,
>> >
>> > I'm not very familiar with setting up constraints in lsqlin but I was
>> > wondering how do write equality constraints so that only some of the
>> > regressors are affected e.g. if I have x1, x2, x3 and x4 and I want x1
>> > to
>> > take any value but x2+x3+x4=1. How can I write this using the form
>> > Aeq*x=beq.
>> >
>> > Any help much appreciated,
>> > Paul
>>
>> The constraint x2+x3+x4 = 1 is equivalent to the constraint 0*x1 + 1*x2 +
>> 1*x3 + 1*x4 = 1 if you assume that x1 must be finite, which is a
>> reasonable
>> assumption when using LSQLIN. Can you convert this new constraint into
>> the
>> form Aeq*x = beq?
>>
>> --
>> Steve Lord
>> slord@mathworks.com
>>
>
> Thanks Steve. I probably should have expanded: I'm trying to run a
> constrainted dummy variable regression with 3 unconstrained regressors and
> two dummy blocks consisting of 10 columns each. The 1st & 2nd dummy blocks
> should add up to 1 respectively.
>
> Paul

The equivalence I mentioned generalizes to any number of regressors that you
want to include or exclude for a given constraint.

Also keep in mind that Aeq can be an m-by-n matrix, where m is the number of
equality constraints and n is the number of regressors. It is not limited
to being a 1-by-n vector. Your expanded problem description requires that m
 >= 2 for your problem.

--
Steve Lord
slord@mathworks.com

Tags for this Thread

What are tags?

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.

Contact us