フィルターのクリア

Discrete equation with two unknown variables

2 ビュー (過去 30 日間)
Ruben Verkempynck
Ruben Verkempynck 2011 年 5 月 20 日
[EDIT: 20110523 16:16 CDT - clarify - WDR]
Hi,
I am looking for a simple way to find out the solution for this equation:
y1 = a*x1/(1+b)*x1
y2 = a*x2/(1/b)*x2
a and b are unkown but x1, x2, y1, y2 are known. I need discrete solutions for this equation and not 1 and 0 as solution. How can I compute this in MatLab, I know it is rather simple by head, but I have been cracking my head over this for several days and never am sure of what I find is right.
  1 件のコメント
Ruben Verkempynck
Ruben Verkempynck 2011 年 5 月 20 日
Guys,
I made a huge mistake the equation should be:
y1 = a*x1/(1+b)*x1
y2 = a*x2/(1+b)*x2

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

採用された回答

Arnaud Miege
Arnaud Miege 2011 年 5 月 20 日
This can be rewritten as:
a*x1^2 - b*y1 = y1
a*x2^2 - b*y2 = y2
or in matrix form:
A * [a b]' = [y1 y2]'
where:
A = [x1^2 -y1; x2^2 -y2];
So:
x1 = 2;
x2 = 3.3;
y1 = 9;
y2 = 2.9;
A = [x1^2 -y1; x2^2 -y2];
RHS = [y1 y1]';
solution = A\RHS;
a = solution(1);
b = solution(2);
HTH,
Arnaud
  12 件のコメント
Arnaud Miege
Arnaud Miege 2011 年 5 月 23 日
Your A and RHS are wrong:
A = [x1^2 -y1; x2^2 -y2];
RHS = [y1 y2]';
solution = A\RHS;
a = solution(1)
b = solution(2)
This gives a = 0 and b = 1:
>> a*x1^2 - b*y1
ans =
37601
>> y1
y1 =
37601
>> a*x2^2 - b*y2
ans =
102743
>> y2
y2 =
102743
>> det(A)
ans =
2.1767e+014
Arnaud Miege
Arnaud Miege 2011 年 5 月 23 日
Correction: b = -1

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

その他の回答 (2 件)

Oleg Komarov
Oleg Komarov 2011 年 5 月 20 日
x1 = 2;
x2 = 3.3;
y1 = 9;
y2 = 2.9;
f = @(ab) [ab(1)*x1/(1+ab(2))*x1 - y1
ab(1)*x2/(1/ab(2))*x2 - y2];
R = fsolve(f,[0 0]);
  4 件のコメント
Arnaud Miege
Arnaud Miege 2011 年 5 月 20 日
fsolve is part of the Optimization Toolbox, see http://www.mathworks.com/help/releases/R2011a/toolbox/optim/ug/fsolve.html
Ruben Verkempynck
Ruben Verkempynck 2011 年 5 月 20 日
OK, thanks, I should get that toolbox.

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


Andrei Bobrov
Andrei Bobrov 2011 年 5 月 20 日
f1 = @(x,x1,x2,y1,y2)[y1-x(1)*x1.^2./(1+x(2));y2-x(1)*x2.^2/(1./x(2))];
x1 = 1;x2 = 2;y1=10;y2=15;
fsolve(@(x)f1(x,x1,x2,y1,y2),[10,10]);

カテゴリ

Help Center および File ExchangeSystems of Nonlinear Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by