フィルターのクリア

Find positive solutions to underdetermined linear system of equations

7 ビュー (過去 30 日間)
Henrik Dam
Henrik Dam 2013 年 5 月 3 日
I'm a bit new to matlab so sorry if this is too simple, in particular i'm new to this forum so I apologise if I did something wrong.
Consider a problem of the following type:
Find x_1,x_2,x_3 > 0 such that
67.5=60*x_1+90*x_2+120*x_3 and
60=30*x_1+120*x_2+90*x_3
In this case I want the solution 0<x_3<3/7, x_2=7/20 - 4/10*x_3 and x_1=2/5-7/5*x_3
Is there a easy way to make Matlab solve such a problem for me?
  2 件のコメント
Matt Kindig
Matt Kindig 2013 年 5 月 3 日
編集済み: Matt Kindig 2013 年 5 月 3 日
Yes, there are a few ways to do what you want. First important question: do you have the Optimization Toolbox? If you type
ver
at the prompt, do you see "Optimization Toolbox" in the listed toolbox?
Henrik Dam
Henrik Dam 2013 年 5 月 4 日
Yes I do :)

サインインしてコメントする。

回答 (1 件)

Shashank Prasanna
Shashank Prasanna 2013 年 5 月 3 日
Henrik, Solving linear systems is easy in MATLAB:
C = [60 90 120;30 120 90];
d = [67.5; 60];
x = C\d;
But as you noticed there aren't any constraints here. If you want to put in your constraints, you will have to setup your own optimization problem - which is easy enough as well. As Matt mentioned if you have the Optimization Toolbox, this will be a much easier exercise.
Here is an example of doing that using an Optimization Toolbox function:
lb = [0;0;0];
ub = [Inf;Inf;3/7]; % lower and upper bounds
Aeq = [0 1 4/10;1 0 7/5];
beq = [7/20;2/5];
x = lsqlin(C,d,[],[],Aeq,beq,lb,ub)
If you want to know what those inputs are you will find that exact information in the link below: http://www.mathworks.com/help/optim/ug/lsqlin.html

カテゴリ

Help Center および File ExchangeGet Started with Optimization Toolbox についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by