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

1 回表示 (過去 30 日間)
Eduardo Jr. Gamez
Eduardo Jr. Gamez 2017 年 11 月 8 日
編集済み: Eric 2017 年 11 月 9 日
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 Center および File ExchangeMathematics and Optimization についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by