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

1 visualizzazione (ultimi 30 giorni)
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?

Risposte (1)

Eric
Eric il 9 Nov 2017
Modificato: Eric il 9 Nov 2017
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.

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by