urgent please help to find the best G and A with following equations using least squares method
Info
This question is closed. Reopen it to edit or answer.
Show older comments
(1) The problem is like this
Write matlab code for this
Use least squares method to find the best G and A
There are three equations with two unknowns
G117+A(1/1.8 )=1
G85+A(1/1.6) =1
G58+A(1/1.4)=1
Solution: i think u have to write in matrix form first
Then initialise the values G as 1 and A as 1
Use the command like “MinErr(G,A)”
U will get the solution
S
please explain this...... thanks in advance
3 Comments
Azzi Abdelmalek
on 20 Oct 2012
what is A(1/1.8 )
Azzi Abdelmalek
on 20 Oct 2012
write clearly your three equations, what are your unknown variables?
Answers (4)
Matt J
on 20 Oct 2012
0 votes
It's a linear equation P*x=q.
Just solve by x=P\q
2 Comments
Azzi Abdelmalek
on 20 Oct 2012
I don't think it's what he is looking for, because, with Least square, you can have more equations then unknown variables.
Matt J
on 20 Oct 2012
Yes, but P\q can handle that situation.
Matt J
on 20 Oct 2012
0 votes
Note that x=P\q does invoke a least squares solver.
1 Comment
Azzi Abdelmalek
on 20 Oct 2012
Yes it do
Matt J
on 20 Oct 2012
0 votes
Then initialise the values G as 1 and A as 1 Use the command like “MinErr(G,A)” U will get the solution S
Because the problem is linear, you do not have to initialize an iterative least squares method. There are closed form algorithms and x=P\q invokes such methods.
Azzi Abdelmalek
on 20 Oct 2012
Edited: Azzi Abdelmalek
on 20 Oct 2012
If your equation is F * x = b with x=[x1;x2] your unknowns variables
x= inv(F'*F)*F'*b
Example
F=rand(3,2)
b=rand(3,1)
x= inv(F'*F)*F'*b
2 Comments
Matt J
on 20 Oct 2012
This is an inefficient way to solve, and in some cases numerically unstable, because cond(F'*F) is typically much larger than cond(F).
That's why the operation F\b is made available by matlab.
Azzi Abdelmalek
on 20 Oct 2012
Apparently F\b invoks least square method
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!