Guessing the values of a function by using initial values
20 次查看(过去 30 天)
显示 更早的评论
Hey there,
I have been trying to use Newton Raphson method in order to get Matlab to guess some unknowns of a function. Hovewer, I did not have any luck doing that. Is there a better way to guess the values of a function?
Also the function I am working on is "f(x,y)=x-((28+y)/2)". And the initial values are; x_init=26.94 y_init=25.87.
Is it a right approach to use Newton Raphson method, or is there a way in Matlab to guess the variables of a function?
6 个评论
Torsten
2022-8-4
编辑:Torsten
2022-8-5
In parameter estimation, you usually have more equations than unknown. The usual Newton-Raphson does not apply in this case.
Look up "Gauss-Newton-algorithm" for more details:
In MATLAB, the functions "lsqlin" (for linear problems) or "lsqcurvefit" (for nonlinear problems) should do what you want.
回答(1 个)
Les Beckham
2022-8-3
编辑:Les Beckham
2022-8-3
You don't have to "guess" the values of the function, you can just calculate them.
Example
x = [-20:.1:20];
y = x;
[X,Y] = meshgrid(x, y);
f = @(x,y) x-((28+y)/2)
Z = f(X,Y);
h = surf(X,Y,Z);
h.EdgeColor = 'none';
If you are trying to find the zeros of the function, that is a different question.
2 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!