fitting a funciton with minimax error
Mostra commenti meno recenti
I am trying to solve a constraint problem regarding minimax error. Basically, I want to fit data to a specific type of function where I minimize the maximum error as the polynomial fit oscillates. This might involve weighting the data differently, fixing some coeffs, etc. The excel file is attached.
I have this code:
clear; clc; close all;
mat =xlsread('C:\example2.xlsx','Sheet1','A2:C32');
density = mat(:,1);
eta = mat(:,2);
Z_MD = mat(:,3);
eta_c = 1/1.55;
I want to fit the x data (eta) vs. y data (Z_MD) to the following functional form:
So I need to solve for my Ak values. How I can I minimize the maximums of the relative error? Obviously, since it's a polynomial, the error will fluctuate. Can I use MATLAB to minimize the maximums?
Currently, when I use cftool to fit the data, when I plot the error of the fit with respect to Z_MD, the maximum error is not minimized, meaning as the polynomial fluctuates through the data points, the error is not bound a constant max error.
Edit: Note that it could be fitting eta and Z_MD. density and eta are the same thing, just multiplied by a constant basically.This is why I changed it to eta, so I want to minimize the maximum error of the polynomial fit to my equation that is fit to x = eta and y = Z_MD.
Risposta accettata
Più risposte (1)
Catalytic
il 2 Apr 2019
1 voto
4 Commenti
Catalytic
il 2 Apr 2019
Can you should me the general way to set this up with my equation?
If I showed you how to set it up with your equation, it wouldn't be "general". Here is a relevant example, though, from the fminimax documentation https://www.mathworks.com/help/optim/ug/fminimax.html#mw_af58b8ea-61b8-4369-a11e-a34798d9535d
Do not simply copy/paste everything and expect it to apply out-of-the-box to your problem. In particular, once you have read the example, you should see that you will have to adapt the way that AbsoluteMaxObjectiveCount is used in your case.
John D'Errico
il 2 Apr 2019
@Benjamin: read my answer.
Categorie
Scopri di più su Assembly in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





