How to find F(x) as a function corresponding to SSE

2 views (last 30 days)
Hello people, I wanted to tune an MPC controller by multi-objective optimization. I got a function named F(x) corresponding to SUM OF SQUARED ERRORS. I wanted to ask you how can I find this F(x) because that x consists of tuning parameters, but there is no x in the SSE.
Screenshot (59).png
I wanted to define objectives like:
function z = MyCost(x)
z1 = Obj1(x);
z2 = Obj2(x);
z = [z1;z2];
end
function z = Obj2(x)
x2 = [-2,-2.06844255255530,-2.10111802240337,-2.10207214215159,-2.07526146517879,-2.02451292412454,-1.95348890083216,-1.86566054982205,-1.76428567628777,-1.65239250853804,-1.53276871647954,-1.40795485019919,-1.28024182188043,-1.15167200960094,-1.02404351080532,-0.898917058220401,-0.777625176916384,-0.661283227599589,-0.550801910577864,-0.446900897244986,-0.350123267963795,-0.260850466015488,-0.179317506175302,-0.105628206097490,-0.0397702372619372,0.0183701798020417,0.0689940848575301,0.112376215326565,0.148852171463276,0.178806387106974,0.202660963499328,0.220865404855298,0.233887277897138,0.242203802594575,0.246294368168910,0.246633957017452,0.243687449431385,0.237904773799427,0.229716860287031,0.219532350663439,0.207735012952757,0.194681806681143,0.180701542780160,0.166094081434884,0.151130010952603,0.136050751841587,0.121069031410732,0.106369676412401,0.0921106733889202,0.0784244493380253,0.0654193282764902,0.0531811225443287,0.0417748210490318,0.0312463401434390,0.0216243062184601,0.0129218426573602,0.00513833705450514,-0.00173883199194378,-0.00773262626427703,-0.0128747520831755,-0.0172041491619834,-0.0207655733923148,-0.0236082804897410,-0.0257848151580808,-0.0273499085178893,-0.0283594847237411,-0.0288697761940985,-0.0289365455299935,-0.0286144109254250,-0.0279562710544354,-0.0270128245343276,-0.0258321784481268,-0.0244595399875494,-0.0229369847493287,-0.0213032950761929,-0.0195938622174165,-0.0178406451639657,-0.0160721798275416,-0.0143136320634388,-0.0125868883911908,-0.0109106784727434,-0.00930072380675527,-0.00776990736488226,-0.00632845933697300,-0.00498415452295366,-0.00374251731512679,-0.00260703063098742,-0.00157934554902706,-0.000659488806718442,0.000153934300292741,0.000863543731151624,0.00147299690655855,0.00198681082126404,0.00241019504596732,0.00274889660542891,0.00300905710790205,0.00319708261386290,0.00331952630454898,0.00338298387253520,0.00339400148083940];
xref = 0;
z = sum((xref - x2).^2);
end
function z = Obj1(x)
x1 = [2,1.63874247131850,1.30113598723865,0.988661074435849,0.702282684517453,0.442501740149494,0.209406582702111,0.00272371795267896,-0.178133542529298,-0.334018122805402,-0.466004651190360,-0.575347586888432,-0.663441885659440,-0.731788066643664,-0.781958253719385,-0.815566925155706,-0.834244359280024,-0.839613210959988,-0.833268126208809,-0.816758276476400,-0.791572673309981,-0.759128111957499,-0.720759575958180,-0.677712916519670,-0.631139620139221,-0.582093472069885,-0.531528922306312,-0.480300962547763,-0.429166326639177,-0.378785833143470,-0.329727696308779,-0.282471640526087,-0.237413663812548,-0.194871306289436,-0.155089291296059,-0.118245418247946,-0.0844565982989858,-0.0537849355427370,-0.0262437680768635,-0.00180359451255733,0.0196021776848615,0.0380717153250028,0.0537295176787565,0.0667214842516229,0.0772103182619426,0.0853712842684588,0.0913883314367051,0.0954505876726022,0.0977492243212971,0.0984746863008280,0.0978142783702301,0.0959500947230647,0.0930572761632816,0.0893025768337506,0.0848432205283080,0.0798260254564022,0.0743867753856379,0.0686498145861152,0.0627278439076208,0.0567218954960092,0.0507214641411961,0.0448047739330606,0.0390391597619528,0.0334815441236355,0.0281789917401103,0.0231693238112417,0.0184817771995578,0.0141376941312045,0.0101512293244300,0.00653006317747807,0.00327611085900524,0.000386218499561911,-0.00214716109894912,-0.00433531950971876,-0.00619267555689865,-0.00773619441822142,-0.00898484589037156,-0.00995910407872319,-0.0106804899069288,-0.0111711571002128,-0.0114535216518036,-0.0115499342062784,-0.0114823942912880,-0.0112723049268382,-0.0109402657837499,-0.0105059027875902,-0.00998773185132617,-0.00940305425603584,-0.00876788109533677,-0.00809688414430708,-0.00740337048650679,-0.00669927826683326,-0.00599519097779952,-0.00530036777418422,-0.00462278741086610,-0.00396920352111308,-0.00334520909327275,-0.00275530814051378,-0.00220299272663229,-0.00169082366174459];
xref = 0;
z = sum((xref - (x1)).^2);
end

Answers (0)

Categories

Find more on Get Started with Optimization Toolbox in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!