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에서 Sources에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by