How to solve 3 equation 2 variable system?

I'm trying to solve these equations:
((((4330-4158)*0.000173-0)*x)+(((4330-4158)*0.000173-0)^(2)*y))28316.85=4.09945
((((4340-4158)*0.000173-0)*x)+(((4340-4158)*0.000173-0)^(2)*y))28316.85=4.1565
((((4513-4158)*0.000173-0)*x)+(((4513-4158)*0.000173-0)^(2)*y))28316.85=7.6936
But when I go with
[x y]=solve('((((4330-4158)*0.000173-0)*x)+(((4330-4158)*0.000173-0)^(2)*y))28316.85=4.09945', '((((4340-4158)*0.000173-0)*x)+(((4340-4158)*0.000173-0)^(2)*y))28316.85=4.1565', '((((4513-4158)*0.000173-0)*x)+(((4513-4158)*0.000173-0)^(2)*y))28316.85=7.6936')
I get and error message about my solve argumentL --> Check for missing argument or incorrect argument data type in call to function 'solve'.

 採用された回答

Cris LaPierre
Cris LaPierre 2020 年 12 月 4 日

1 投票

b = [4.09945; 4.1565; 7.6936]./28316.85;
A = [((4330-4158)*0.000173-0) ((4330-4158)*0.000173-0)^2;
((4340-4158)*0.000173-0) ((4340-4158)*0.000173-0)^2;
((4513-4158)*0.000173-0) ((4513-4158)*0.000173-0)^2];
c = A\b % x=c(1), y=c(2)
c = 2×1
0.0051 -0.0110
btw, your expressions are missing a "*" before the 28316.85.

4 件のコメント

Jorge Villarreal
Jorge Villarreal 2020 年 12 月 4 日
I was missing the * and typed it in and it still didn't work by that linear method.
So I calculated with the matrix, but when replacing the values, I'm still not getting the correct answer on my equations.
Again, I used this formula first then the matrix you suggested
[x y]=solve('((((4330-4158)*0.000173-0)*x)+(((4330-4158)*0.000173-0)^(2)*y))*28316.85=4.09945', '((((4340-4158)*0.000173-0)*x)+(((4340-4158)*0.000173-0)^(2)*y))*28316.85=4.1565', '((((4513-4158)*0.000173-0)*x)+(((4513-4158)*0.000173-0)^(2)*y))*28316.85=7.6936')
BTW I'm new to MatLab. Bare with me.
Cris LaPierre
Cris LaPierre 2020 年 12 月 4 日
In 20b, which you indicate you are using, the recommended way of setting up solve is like this:
syms x y
eq1 = (((4330-4158)*0.000173-0)*x + ((4330-4158)*0.000173-0)^2*y)*28316.85 == 4.09945;
eq2 = (((4340-4158)*0.000173-0)*x + ((4340-4158)*0.000173-0)^2*y)*28316.85 == 4.1565;
eq3 = (((4513-4158)*0.000173-0)*x + ((4513-4158)*0.000173-0)^2*y)*28316.85 == 7.6936;
[X Y]=solve([eq1, eq2, eq3],[x y])
X = Empty sym: 0-by-1 Y = Empty sym: 0-by-1
However, as you can see, it is unable to find a solution. I did try vpasolve as well but got the same result. You may need someone who is better at using solve than me. However, my original reply does show how to get a solution using linear algebra. This is equivalent to using linsolve.
Jorge Villarreal
Jorge Villarreal 2020 年 12 月 4 日
Ok, I see.
I need to investigate how to plot eq then to analyze the data and get the correct solution. I just did a 20 minute video about overdetermined systems and I believe this one is inconsistent. If I plot the eq, I can then narrow my search for values.
Thanks!
Jorge Villarreal
Jorge Villarreal 2020 年 12 月 4 日
I am so sorry! I misintepreted a value. Turns out the first answer you gave was the corret one.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSymbolic Math Toolbox についてさらに検索

製品

リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by