For which value of the scalar "b" does the (yet unspecified) function, y = f(x,b), go perfectly through the measured values?

1 次查看(过去 30 天)
Imagine we have some function, y = f(x,b), which produces a n-vector of model outputs using as input the n-vector "x" and scalar "b". We collect the following data (for example):
x= 0 1 5 y_obs= 2 5 6
For which value of the scalar "b" does the (yet unspecified) function, y = f(x,b), go perfectly through the measured values?
Any examples of a question like this?

回答(1 个)

Eric
Eric 2017-11-9
编辑:Eric 2017-11-9
Here is an example:
f = @(x,b) x+b; % What you are asking is impossible without defining f.
x = [0 1 5];
y_obs = [2 5 6];
[best_b,MSE] = fminsearch(@(b) mean((y_obs-f(x,b)).^2), 0);
This will minimize the mean squared error (MSE) between the function and your observations by adjusting b. The MSE should be 0 if you expect it to go perfectly through the values. In my example, the MSE is not zero because I was too lazy to figure out a function that would work.

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by