How to determine the value of two constants among lot of equations?
3 views (last 30 days)
Show older comments
Hello. I want to determine the value of two constants X and Y, among a lot of equations. I mean, equations such as:
2^X=3*Y
4^X=5*Y
7^X=10*Y
15^X=34*Y
..... and more.
How THE value of X and Y? Thank you very much!
1 Comment
Matt Kindig
on 7 May 2013
Are you looking for a single value for X and Y that satisfy all of these equations? Because there does not exist a unique solution that satisfies all four of the equations you've shown.
If you take the equations two at a time, you can just use algebra to solve for X and Y by hand. I just did it, and unless my math is wrong:
Given: b1^X = a1*Y; b2^X = a2*Y
Solution: X = log(a1/a2)/log(b1/b2); Y = (1/3)*2^X
Answers (1)
Matt J
on 7 May 2013
Edited: Matt J
on 7 May 2013
If you take the log of both sides, you will get linear equations in X and log(Y), e.g., your first 2 equations become
X*log2-log(Y)=log(3)
X*log4-log(Y)=log(5)
so you can solve using MATLAB's usual linear equation solvers
xlogy = [log([2;4]),-ones(2,1)]\log([3;5]);
x=xlogy(1), y=exp(xlogy(2))
1 Comment
Matt J
on 7 May 2013
For more than 2 equations, this will give you a least squares fit to X and log(Y). You'll have to decide whether that's what you want.
See Also
Categories
Find more on Partial Differential Equation Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!