Solve (a*B) + (c*D) = E without the Symbolic Toolbox

4 次查看(过去 30 天)
Solve (a*B) + (c*D) = E without the Symbolic Toolbox
where, B, D, & E are all known.
If the Symbolic Toolbox was available it would looke like this:
syms a c
eqn = ((a*B) + (c*D)) / E == 1;
x = solve( eqn );
Any help would be greatly appreciated.
(Available toolboxes include: Image Processing, Signal Processing, & Statistical and Machine Learning

采纳的回答

Star Strider
Star Strider 2020-9-25
This would seem to be homework, and for homework we only give guidance and hints.
I would set it up as an implicit equation (so it equals 0), and use fsolve. To do this, ‘a’ and ‘c’ would have to be parameterized as ‘p(1)’ and ‘p(2)’, and you would have to code it as an anonymous function. .
  10 个评论
Michael Garvin
Michael Garvin 2020-9-28
I'm needing to find a single ‘A’ & ‘C’ that best fits ‘B’, ‘D’, and ‘E’. I think the ‘\’will work, as described above by Star Strider, but I will definitely look at Ivo Houtzagar's link. Thank you.
Star Strider
Star Strider 2020-9-28
Experiment with something like this:
p = [B(:) D(:)] \ E(:);
a = p(1)
c = p(2)
If I understand correctly what you are doing, that should work.
To also get statistics with the parameter estimates, use the regress or fitlm functions, depending on what you want to do.

请先登录,再进行评论。

更多回答(3 个)

Walter Roberson
Walter Roberson 2020-9-25
((a*B) + (c*D)) / E == 1
((a*B) + (c*D)) == 1 * E
a*B + c*D == E
a*B == E - c*D
a == (E-c*D) / B
a == E/B - D/B * c
a == (-D/B) * c + (E/B)
Parameterized:
c = t
a = (-D/B) * t + (E/B)
You have one equation in two variables; you are not going to be able to solve for both variables simultaneously.

Ivo Houtzager
Ivo Houtzager 2020-9-25
编辑:Ivo Houtzager 2020-9-25
A = E*pinv([B; D]);
a = A(1);
c = A(2);

Steven Lord
Steven Lord 2020-9-26
This is a generalization of Cleve's simplest impossible problem. Cleve's has B = 1/2, D = 1/2, E = 3.

类别

Help CenterFile Exchange 中查找有关 Formula Manipulation and Simplification 的更多信息

标签

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by