How to determine the value of two constants among lot of equations?
5 次查看(过去 30 天)
显示 更早的评论
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 个评论
Matt Kindig
2013-5-7
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
回答(1 个)
Matt J
2013-5-7
编辑:Matt J
2013-5-7
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 个评论
Matt J
2013-5-7
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Mathematics and Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!