How to minimize the maximum error?
古いコメントを表示
Good day everyone,
I have this pack of data that are functions of three variables (say, x1, x2 and x3). How do I choose a linear approximating function that minimizes the maximum error between the linear function and the data? I'm getting some approximating functions with an other software that cannot provide this specific detail to choose between them, though, so I'm quite stuck.
On the other hand I've been suggested to use fminimax in MatLab, but it doesn't seem to be usable in this case (to me, and I'm not a "so experienced user" so I may be wrong).
Thank you so much in advance!
Stefano
採用された回答
その他の回答 (1 件)
Example:
rng('default')
n = 100;
x1 = rand(n,1);
x2 = rand(n,1);
x3 = rand(n,1);
y = rand(n,1);
f = [1; 0 ;0; 0; 0];
A = [-ones(n,1),ones(n,1),x1,x2,x3;-ones(n,1),-ones(n,1),-x1,-x2,-x3];
b = [y;-y];
[sol,fval] = linprog(f,A,b)
t = sol(1)
a = sol(2)
b = sol(3)
c = sol(4)
d = sol(5)
3 件のコメント
Stefano Gilardoni
2023 年 6 月 8 日
Stefano Gilardoni
2023 年 6 月 8 日
Torsten
2023 年 6 月 8 日
Instead of
x1 = rand(n,1);
x2 = rand(n,1);
x3 = rand(n,1);
y = rand(n,1);
you just have to supply your data as column vectors.
カテゴリ
ヘルプ センター および File Exchange で Solver Outputs and Iterative Display についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!