"someone" wrote in message <mpdc5s$air$1@newscl01ah.mathworks.com>...
> "Edoardo" wrote in message <mpb39b$1kb$1@newscl01ah.mathworks.com>...
> > I tried to solve this problem:
> >
> > find the value of both x1 and x2 in the following expression
> >
> > c1= a1*x1+a2*x2
> >
> > where:
> >
> > c1 is a given value
> >
> > a1 and a2 are constants
> >
> > x1 is bounded between 1400 and 1650
> >
> > x2 is bounded between 95 and 195
> >
> > I tried to use linear programming optimization with equality constrain but seems to not work.
> >
> > It seems a really simple problem for me but I am not able to produce a code so solve it
> >
> > Thanks for your help and time
>
> You can solve for x1 (or x2) element -by-element:
>
> x1 = (c - a2 .* x2) ./ a1; % where x2 = [95:195]
>
> So then you just need to know the INTERSECTION of the x1 above allowable solutions with [1400:1500].
>
> I am assuming you only want integer values. Otherwise...
Thanks for the help.
Actually being physical quantity (density) I am looking not just for integer values...
> "Edoardo" wrote in message <mpb39b$1kb$1@newscl01ah.mathworks.com>...
> > I tried to solve this problem:
> >
> > find the value of both x1 and x2 in the following expression
> >
> > c1= a1*x1+a2*x2
> >
> > where:
> >
> > c1 is a given value
> >
> > a1 and a2 are constants
> >
> > x1 is bounded between 1400 and 1650
> >
> > x2 is bounded between 95 and 195
> >
> > I tried to use linear programming optimization with equality constrain but seems to not work.
> >
> > It seems a really simple problem for me but I am not able to produce a code so solve it
> >
> > Thanks for your help and time
>
> You can solve for x1 (or x2) element -by-element:
>
> x1 = (c - a2 .* x2) ./ a1; % where x2 = [95:195]
>
> So then you just need to know the INTERSECTION of the x1 above allowable solutions with [1400:1500].
>
> I am assuming you only want integer values. Otherwise...
Thanks for the help.
Actually being physical quantity (density) I am looking not just for integer values...