How to put control energy and gain in a loop

1 view (last 30 days)
Hello people! I got a question about constructing a control loop. I've optimized and solved my control problem using standard solver and I got ubar as mean of u and xbar as mean of system states and K as gain and also a system defined by A,B,G,...
xdot = A*x + B*u + G*w
there is no C matrix or D matrix or any info about them. also an affine feedback is assumed there u = K * (x - xbar) + ubar
I wanted to put gain (K) and mean of control signal (ubar) in a loop and give them to system and plot states, but I don't know how to find close loop response.
I've already tried lsim, but there was a bunch of errors about dimension of matrices etc
clc;
clear;
close all;
%% Time structure
dt=1;
tf = 10;
t = 0:dt:tf-1;
t = t';
%% System structure
A = [1.02 -0.1
0.1 0.98];
B = [0.5 0
0.05 0.5];
G = [0.3 0
0 0.3];
%%
ubar = [-0.000581629157055178,-0.000581629156609152,-0.000581629281438909,-0.000581629281440897,-0.000581629281439613,-0.000581629281441646,-0.000581629281439253,-0.000581629281441243,-0.000581629283745490,-0.000581629284144206,131.400927231750,0,-43.5899689825575,-87.3447946140090,-0.121677240258015,-0.227961850128840,-0.0869533824650604,-0.130839304907035,-0.00960202231921041,-0.00960984528042930,0.0454701361380619,0.0690829738668646,-0.000581629151442759,-0.000581629150976575,-0.000581629281437736,-0.000581629281439817,-0.000581629281438418,-0.000581629281440531,-0.000581629281438100,-0.000581629281440181,-0.000581629283848340,-0.000581629284265049,65.9612196789050,0,0.0163528663340642,-0.0115687495095834,-21.9613299789049,-43.9177482522026,-0.0351465169397885,-0.0573268811696319,-0.00848969500416555,-0.0139375019482108,0.00936976354254012,0.0126783667337945,-0.000581629145856014,-0.000581629145369818,-0.000581629281436549,-0.000581629281438723,-0.000581629281437267,-0.000581629281439437,-0.000581629281436938,-0.000581629281439131,-0.000581629283950715,-0.000581629284385333,0;-0.000528160807600932,-0.000528160806858417,-0.000528161014656819,-0.000528161014660146,-0.000528161014657446,-0.000528161014660808,-0.000528161014657155,-0.000528161014660429,-0.000528161018496181,-0.000528161019159948,218.736767442156,0,-72.5618189454592,-145.398065579508,-0.202155519406871,-0.379025814694336,-0.144353434705365,-0.217349689091955,-0.0155478255728175,-0.0155653199308984,0.0761167937761455,0.115615840165787,-0.000528160798780068,-0.000528160798005902,-0.000528161014654947,-0.000528161014658418,-0.000528161014655624,-0.000528161014659124,-0.000528161014655291,-0.000528161014658731,-0.000528161018657842,-0.000528161019349869,109.538144585391,0,0.0273450560748362,-0.0190569345422484,-36.4695717310723,-72.9307300429299,-0.0578364398062356,-0.0947345049761504,-0.0136866268276673,-0.0227458754979369,0.0159240204457714,0.0215664414794175,-0.000528160790044915,-0.000528160789239457,-0.000528161014653141,-0.000528161014656719,-0.000528161014653785,-0.000528161014657422,-0.000528161014653464,-0.000528161014657056,-0.000528161018817937,-0.000528161019537960,0;-0.000464850276767520,-0.000464850276767507,-0.000464850276766848,-0.000464850276766868,-0.000464850276767458,-0.000464850276767449,-0.000464850276767172,-0.000464850276767166,-0.000464850276767130,-0.000464850276767136,-0.00464850251156834,0,0,0,0,0,0,0,0,0,0,0,-0.000464850148258548,-0.000464850147797768,-0.000464850276739902,-0.000464850276742009,-0.000464850276740514,-0.000464850276742547,-0.000464850276740215,-0.000464850276742327,-0.000464850279122408,-0.000464850279534250,0,65.1932395076792,0.0163002305454987,-0.0113383082218456,-21.7054853369752,-43.4060306759143,-0.0346084968557704,-0.0565336465142243,-0.00832334193286985,-0.0137285737033249,0.00927132212395355,0.0125888175165625,-0.000464850142736338,-0.000464850142255738,-0.000464850276738761,-0.000464850276740947,-0.000464850276739355,-0.000464850276741506,-0.000464850276739047,-0.000464850276741207,-0.000464850279223623,-0.000464850279653178,0;-0.000422890131101226,-0.000422890131101213,-0.000422890131100429,-0.000422890131100414,-0.000422890131100958,-0.000422890131100997,-0.000422890131100708,-0.000422890131100690,-0.000422890131100695,-0.000422890131100693,-0.00422890107641037,0,0,0,0,0,0,0,0,0,0,0,-0.000422889917178537,-0.000422889916411515,-0.000422890131055573,-0.000422890131059036,-0.000422890131056160,-0.000422890131059569,-0.000422890131055833,-0.000422890131059312,-0.000422890135021385,-0.000422890135706981,0,108.524418821749,0.0273655844303290,-0.0185747423894637,-36.1317741553739,-72.2557401916522,-0.0572547780465873,-0.0938525774969211,-0.0134878862596612,-0.0224802718950870,0.0158385014160028,0.0213127948735551,-0.000422889908523924,-0.000422889907725896,-0.000422890131053791,-0.000422890131057371,-0.000422890131054291,-0.000422890131057855,-0.000422890131054043,-0.000422890131057684,-0.000422890135180004,-0.000422890135893310,0;-0.000348309691892651,-0.000348309691892663,-0.000348309691892179,-0.000348309691892155,-0.000348309691892598,-0.000348309691892604,-0.000348309691892381,-0.000348309691892382,-0.000348309691892379,-0.000348309691892380,-0.00348309672703811,0,0,0,0,0,0,0,0,0,0,0,-0.000348309691892901,-0.000348309691892894,-0.000348309691892164,-0.000348309691892170,-0.000348309691892627,-0.000348309691892591,-0.000348309691892341,-0.000348309691892409,-0.000348309691892398,-0.000348309691892359,-0.00348309672711165,0,0,0,0,0,0,0,0,0,0,0,-0.000348309559422107,-0.000348309558947132,-0.000348309691864400,-0.000348309691866537,-0.000348309691864830,-0.000348309691866954,-0.000348309691864606,-0.000348309691866753,-0.000348309694320250,-0.000348309694744800,43.0436491684950;-0.000317448440512582,-0.000317448440512563,-0.000317448440511949,-0.000317448440511982,-0.000317448440512401,-0.000317448440512368,-0.000317448440512166,-0.000317448440512180,-0.000317448440512168,-0.000317448440512169,0,-0.00317448422922303,0,0,0,0,0,0,0,0,0,0,-0.000317448440512921,-0.000317448440512929,-0.000317448440511979,-0.000317448440511974,-0.000317448440512384,-0.000317448440512391,-0.000317448440512184,-0.000317448440512162,-0.000317448440512158,-0.000317448440512165,0,0,0,-0.00317448422917531,0,0,0,0,0,0,0,0,-0.000317448219995202,-0.000317448219204558,-0.000317448440465745,-0.000317448440469294,-0.000317448440466157,-0.000317448440469703,-0.000317448440465946,-0.000317448440469510,-0.000317448444553722,-0.000317448445260454,71.6525962622234;-0.000231995660577032,-0.000231995660577031,-0.000231995660576716,-0.000231995660576710,-0.000231995660577010,-0.000231995660577012,-0.000231995660576852,-0.000231995660576864,-0.000231995660576856,-0.000231995660576843,-0.00231995647779437,0,0,0,0,0,0,0,0,0,0,0,-0.000231995660577191,-0.000231995660577196,-0.000231995660576725,-0.000231995660576713,-0.000231995660577007,-0.000231995660577007,-0.000231995660576840,-0.000231995660576861,-0.000231995660576864,-0.000231995660576847,-0.00231995647789305,0,0,0,0,0,0,0,0,0,0,0,-0.000231995660577381,-0.000231995660577364,-0.000231995660576710,-0.000231995660576727,-0.000231995660577002,-0.000231995660576996,-0.000231995660576870,-0.000231995660576862,-0.000231995660576844,-0.000231995660576842,-0.00231995647785187;-0.000211826109957114,-0.000211826109957123,-0.000211826109956741,-0.000211826109956731,-0.000211826109957007,-0.000211826109957004,-0.000211826109956862,-0.000211826109956874,-0.000211826109956863,-0.000211826109956857,-0.00211826098199697,0,0,0,0,0,0,0,0,0,0,0,-0.000211826109957367,-0.000211826109957373,-0.000211826109956736,-0.000211826109956738,-0.000211826109957001,-0.000211826109956983,-0.000211826109956865,-0.000211826109956888,-0.000211826109956864,-0.000211826109956847,-0.00211826098199371,0,0,0,0,0,0,0,0,0,0,0,-0.000211826109957630,-0.000211826109957637,-0.000211826109956729,-0.000211826109956725,-0.000211826109957006,-0.000211826109957009,-0.000211826109956874,-0.000211826109956867,-0.000211826109956849,-0.000211826109956848,-0.00211826098201988;-0.000115896358074462,-0.000115896358074466,-0.000115896358074303,-0.000115896358074301,-0.000115896358074452,-0.000115896358074453,-0.000115896358074381,-0.000115896358074372,-0.000115896358074371,-0.000115896358074375,-0.00115896351700854,0,0,0,0,0,0,0,0,0,0,0,-0.000115896358074550,-0.000115896358074549,-0.000115896358074301,-0.000115896358074296,-0.000115896358074455,-0.000115896358074451,-0.000115896358074373,-0.000115896358074376,-0.000115896358074373,-0.000115896358074374,-0.00115896351693273,0,0,0,0,0,0,0,0,0,0,0,-0.000115896358074637,-0.000115896358074632,-0.000115896358074308,-0.000115896358074307,-0.000115896358074440,-0.000115896358074445,-0.000115896358074386,-0.000115896358074375,-0.000115896358074369,-0.000115896358074373,-0.00115896351684206;-0.000106013267225743,-0.000106013267225713,-0.000106013267225495,-0.000106013267225514,-0.000106013267225653,-0.000106013267225657,-0.000106013267225582,-0.000106013267225581,-0.000106013267225585,-0.000106013267225582,-0.00106013261349873,0,0,0,0,0,0,0,0,0,0,0,-0.000106013267225860,-0.000106013267225836,-0.000106013267225499,-0.000106013267225518,-0.000106013267225656,-0.000106013267225653,-0.000106013267225577,-0.000106013267225580,-0.000106013267225585,-0.000106013267225581,0,0,0,0,0,0,0,0,0,0,-0.00106013261343957,0,-0.000106013267225990,-0.000106013267225966,-0.000106013267225503,-0.000106013267225519,-0.000106013267225655,-0.000106013267225648,-0.000106013267225582,-0.000106013267225588,-0.000106013267225578,-0.000106013267225575,-0.00106013261328094];
K = [44.0635380945976,0.0144792342297621,0.00899088120540256,-0.0124382672869247,-0.0223441170985152,-14.6762348967978,-29.3464412433947,-0.0100789965127368,-0.0183297272704375,-0.00148141843763935,-0.00558644338784057,-0.000581629140520318,-0.000581629140014967,-0.000581629281435421,-0.000581629281437707,-0.000581629281436155,-0.000581629281438415,-0.000581629281435776,-0.000581629281438066,-0.000581629284048542,-0.000581629284500241,33.1028257072545,0,0.0112490119602310,0.0112473556934346,-0.00292777573905732,-0.00436087360384590,-0.00834074815108921,-0.0130520322384191,-11.0275646016738,-22.0540143645686,-0.00657393380603968,-0.0144146452715128,-0.000581629135519974,-0.000581629134996698,-0.000581629281434357,-0.000581629281436717,-0.000581629281435096,-0.000581629281437487,-0.000581629281434781,-0.000581629281437079,-0.000581629284140153,-0.000581629284607911,26.5256579509458,0,0.00835038284765902,0.00947832280545638,-0.000533997427724830,-6.68585671312291e-06,-0.00405488169836614,-0.00564807655900998,-0.00595031101092397,-0.0109888523403815,-8.84050296644894,-17.6817277853915;72.9973128950942,0.0244479819082575,0.0153090895709597,-0.0201779270976766,-0.0365491331966745,-24.3128391828889,-48.6159239970137,-0.0161442327881510,-0.0300272845581608,-0.00200941463662751,-0.00878084663970879,-0.000528160781767472,-0.000528160780932333,-0.000528161014651370,-0.000528161014655111,-0.000528161014652074,-0.000528161014655837,-0.000528161014651727,-0.000528161014655437,-0.000528161018969639,-0.000528161019716197,54.7082630863979,0,0.0189286284954669,0.0189103757597692,-0.00454113156244581,-0.00689384922596755,-0.0135015600147111,-0.0210767833743903,-18.2242737481433,-36.4471019107356,-0.0105525110348784,-0.0235426487928676,-0.000528160774083449,-0.000528160773220748,-0.000528161014649796,-0.000528161014653655,-0.000528161014650437,-0.000528161014654326,-0.000528161014650111,-0.000528161014653958,-0.000528161019110479,-0.000528161019881656,0,43.7323827136632,0.0140321836641676,0.0159035734195373,-0.000542426950676478,0.000364240646642466,-0.00625922274696526,-0.00888142880463039,-0.00945508644359899,-0.0175429498368847,-14.5745638190296,-29.1508198297976;43.5507054837716,0.0144200653254241,0.00898094935076691,-0.0121928816277802,-0.0219638690448114,-14.5053129127818,-29.0047439028058,-0.00984404045116668,-0.0180157931805780,-0.00131719338963689,-0.00536440740900765,-0.000464850137462193,-0.000464850136962711,-0.000464850276737639,-0.000464850276739886,-0.000464850276738278,-0.000464850276740523,-0.000464850276737923,-0.000464850276740185,-0.000464850279320284,-0.000464850279766736,0,32.7179153179613,0.0112345673342110,0.0112163959609964,-0.00278319683941357,-0.00418577411828557,-0.00814214715349870,-0.0128358008736269,-10.8992135703394,-21.7973468908096,-0.00639021248503765,-0.0141171908707592,-0.000464850132519463,-0.000464850132002244,-0.000464850276736625,-0.000464850276738974,-0.000464850276737208,-0.000464850276739529,-0.000464850276736892,-0.000464850276739237,-0.000464850279410886,-0.000464850279873170,0,26.2170978854204,0.00839666410543007,0.00946862846858551,-0.000444547095147061,8.91388874535797e-05,-0.00392615549751531,-0.00547020218953360,-0.00581631085589865,-0.0107350123263100,-8.73755516972260,-17.4757534214187;72.3219199166351,0.0241936868346877,0.0151660575668501,-0.0200027039117206,-0.0362572464667515,-24.0877901457276,-48.1657843934554,-0.0158107503157870,-0.0295520299572297,-0.00180944623703407,-0.00850184559544692,-0.000422889900322715,-0.000422889899495272,-0.000422890131052072,-0.000422890131055772,-0.000422890131052567,-0.000422890131056314,-0.000422890131052341,-0.000422890131056058,-0.000422890135330305,-0.000422890136069922,0,54.2017664448784,0.0189102797440820,0.0188790780054832,-0.00431688326309377,-0.00666606535534156,-0.0132115671865431,-0.0207785265821466,-18.0555781694114,-36.1098118292599,-0.0103030776224307,-0.0231185845624800,-0.000422889892709482,-0.000422889891854738,-0.000422890131050451,-0.000422890131054295,-0.000422890131050992,-0.000422890131054839,-0.000422890131050725,-0.000422890131054571,-0.000422890135469843,-0.000422890136233858,43.3276919263775,0,0.0140211697873117,0.0160142083983239,-0.000366651051102402,0.000478818303015614,-0.00607735037249898,-0.00860533574328808,-0.00911470174798128,-0.0173708258234057,-14.4396727514416,-28.8812274072871;0,0.0143473042089087,0.00895446326796452,-0.0119783647393111,-0.0216170886824211,-14.3363020536890,-28.6668482923762,-0.00959862061015196,-0.0176755508650136,-0.00120934496620102,-0.00520471650514216,-0.000348309554208820,-0.000348309553715187,-0.000348309691863313,-0.000348309691865506,-0.000348309691863733,-0.000348309691865966,-0.000348309691863537,-0.000348309691865716,-0.000348309694415777,-0.000348309694857077,32.3368807977701,0,0.0112181867735355,0.0112050146547400,-0.00264624138886693,-0.00403942571585900,-0.00793936627616469,-0.0125083755937647,-10.7721706065646,-21.5434283256527,-0.00620675334625093,-0.0138480011120754,-0.000348309549323091,-0.000348309548811909,-0.000348309691862276,-0.000348309691864573,-0.000348309691862713,-0.000348309691865016,-0.000348309691862500,-0.000348309691864786,-0.000348309694505334,-0.000348309694962264,0,25.9122873075480,0.00837341318636336,0.00954768611622805,-0.000271138675591953,0.000155350652316167,-0.00376835543820737,-0.00533741699325959,-0.00563027057910208,-0.0105847090624864,-8.63581190567657,-17.2724430575202;0,0.0240875170155106,0.0151235909454769,-0.0197116546030324,-0.0358156872907119,-23.8645602682563,-47.7198464280140,-0.0155440294572866,-0.0292536758614791,-0.00181252602425768,-0.00843758446433569,-0.000317448211869598,-0.000317448211049784,-0.000317448440464021,-0.000317448440467722,-0.000317448440464449,-0.000317448440468131,-0.000317448440464258,-0.000317448440467932,-0.000317448444702636,-0.000317448445435430,53.7005126816206,0,0.0188306154290914,0.0187983500141845,-0.00418479906990456,-0.00650422788317405,-0.0129787758516639,-0.0206037169145362,-17.8884600942730,-35.7756277679274,-0.0100996300998782,-0.0228571188161968,-0.000317448204326399,-0.000317448203479583,-0.000317448440462472,-0.000317448440466267,-0.000317448440462869,-0.000317448440466661,-0.000317448440462651,-0.000317448440466486,-0.000317448444840901,-0.000317448445597841,0,42.9271217709031,0.0140008448155133,0.0158117464386425,-0.000281578836956038,0.000561272672078999,-0.00608381201958536,-0.00834542194250592,-0.00891479934815123,-0.0171139707435029,-14.3061071810531,-28.6138233546433;0,0,0,0,0,0,0,0,0,0,0,-0.000231995524496290,-0.000231995524008378,-0.000231995660548183,-0.000231995660550392,-0.000231995660548475,-0.000231995660550666,-0.000231995660548338,-0.000231995660550513,-0.000231995663070879,-0.000231995663507021,31.9604088939063,0,0.0112066324330570,0.0112147539670611,-0.00249739118314646,-0.00392555353680225,-0.00771411199815516,-0.0122641592061716,-10.6466425028912,-21.2924601288557,-0.00600142224565183,-0.0136449665955420,-0.000231995519666879,-0.000231995519161643,-0.000231995660547176,-0.000231995660549459,-0.000231995660547456,-0.000231995660549719,-0.000231995660547326,-0.000231995660549600,-0.000231995663159393,-0.000231995663610998,0,25.6105655006555,0.00825393995232175,0.00935996007256233,-0.000324169279509413,0.000194898147037028,-0.00372020476659378,-0.00501585548608801,-0.00530996212076040,-0.0101735252828744,-8.53504170390693,-17.0711088341814;0,0,0,0,0,0,0,0,0,0,0,-0.000211825883430054,-0.000211825882617863,-0.000211826109909245,-0.000211826109912894,-0.000211826109909523,-0.000211826109913165,-0.000211826109909373,-0.000211826109913023,-0.000211826114108563,-0.000211826114834567,53.2033600166952,0,0.0188448086146954,0.0187787624459470,-0.00397036507284986,-0.00630757558107225,-0.0127006896994598,-0.0202050826654821,-17.7227112959222,-35.4443641534376,-0.00985352249305821,-0.0229891634134136,-0.000211825875956376,-0.000211825875117378,-0.000211826109907680,-0.000211826109911447,-0.000211826109907945,-0.000211826109911717,-0.000211826109907806,-0.000211826109911582,-0.000211826114245537,-0.000211826114995488,42.5305249978802,0,0.0140376983366531,0.0159144637481751,-0.000164166896230518,0.000626851134912908,-0.00600537149991451,-0.00843348581306537,-0.00900589897935376,-0.0169609079999982,-14.1736314302266,-28.3490210102000;0,0,0,0,0,0,0,0,0,0,0,-0.000115896358074734,-0.000115896358074724,-0.000115896358074296,-0.000115896358074303,-0.000115896358074448,-0.000115896358074456,-0.000115896358074386,-0.000115896358074361,-0.000115896358074363,-0.000115896358074379,-0.00115896351690545,0,0,0,0,0,0,0,0,0,0,0,-0.000115896218804857,-0.000115896218305517,-0.000115896358045113,-0.000115896358047351,-0.000115896358045253,-0.000115896358047496,-0.000115896358045170,-0.000115896358047424,-0.000115896360626858,-0.000115896361073200,0,25.3125511016011,0.00836257814113481,0.00941757713773058,-0.000126986021959314,0.000379968576672813,-0.00350929619294082,-0.00494546128359014,-0.00522984039418426,-0.0100579904300554,-8.43566564435439,-16.8723349700185;0,0,0,0,0,0,0,0,0,0,0,-0.000106013267226122,-0.000106013267226104,-0.000106013267225503,-0.000106013267225519,-0.000106013267225655,-0.000106013267225651,-0.000106013267225582,-0.000106013267225583,-0.000106013267225577,-0.000106013267225575,0,-0.00106013261346298,0,0,0,0,0,0,0,0,0,0,-0.000106013035390354,-0.000106013034559113,-0.000106013267176911,-0.000106013267180650,-0.000106013267177042,-0.000106013267180788,-0.000106013267176985,-0.000106013267180711,-0.000106013271474569,-0.000106013272217585,0,42.1367074550257,0.0140593145017628,0.0158875194539718,-6.90156975402793e-05,0.000796806145614419,-0.00560810907779284,-0.00825150493231501,-0.00872792090512335,-0.0167696079526953,-14.0424571232569,-28.0866279454555];
xbar = [0.919709185421472,0.919709185421695,0.919709185359281,0.919709185359280,0.919709185359280,0.919709185359279,0.919709185359280,0.919709185359279,0.919709185358127,0.919709185357928,66.6204636158750,0.920000000000000,-20.8749844912788,-42.7523973070045,0.859161379870993,0.806019074935580,0.876523308767470,0.854580347546483,0.915198988840395,0.915195077359785,0.942735068069031,0.954541486933432,0.919709185424279,0.919709185424512,0.919709185359281,0.919709185359280,0.919709185359281,0.919709185359280,0.919709185359281,0.919709185359280,0.919709185358076,0.919709185357868,33.9006098394525,0.920000000000000,0.928176433167032,0.914215625245208,-10.0606649894525,-21.0388741261013,0.902426741530106,0.891336559415184,0.915755152497917,0.913031249025895,0.924684881771270,0.926339183366897,0.919709185427072,0.919709185427315,0.919709185359282,0.919709185359281,0.919709185359281,0.919709185359280,0.919709185359282,0.919709185359281,0.919709185358025,0.919709185357807,0.920000000000000;1.07970683813835,1.07970683813874,1.07970683802860,1.07970683802860,1.07970683802860,1.07970683802860,1.07970683802860,1.07970683802860,1.07970683802656,1.07970683802621,117.018430082666,1.08000000000000,-37.3804079218575,-75.9862725204545,0.972838378283664,0.879089000146390,1.00347561352406,0.964783190208671,1.07174598609763,1.07173684777053,1.12033190369498,1.14126206877624,1.07970683814304,1.07970683814345,1.07970683802860,1.07970683802860,1.07970683802860,1.07970683802860,1.07970683802860,1.07970683802860,1.07970683802648,1.07970683802611,59.1471332766407,1.08000000000000,1.09449017135412,1.06989309525340,-18.2528523644814,-37.5812524340751,1.04932445424989,1.02976640345344,1.07273220183596,1.06793018715362,1.08843049840001,1.09141713907640,1.07970683814768,1.07970683814811,1.07970683802860,1.07970683802860,1.07970683802860,1.07970683802860,1.07970683802860,1.07970683802860,1.07970683802639,1.07970683802601,1.08000000000000;0.829900260177684,0.829900260177872,0.829900260125223,0.829900260125222,0.829900260125222,0.829900260125221,0.829900260125222,0.829900260125222,0.829900260124250,0.829900260124082,56.2487056286702,0.830400000000000,-17.5544433889186,-36.0088180010992,0.779060769640046,0.734230556419653,0.793706213590413,0.775193635476545,0.826328370007440,0.826325294129928,0.849556579060914,0.859506109794477,0.829900260244331,0.829900260244758,0.829900260125237,0.829900260125235,0.829900260125236,0.829900260125234,0.829900260125236,0.829900260125235,0.829900260123028,0.829900260122647,28.6639087085775,33.4270197538396,0.845441059967710,0.819841474113850,-19.2893357212810,-39.4045417031730,0.798238582507833,0.777919827001031,0.822635364397845,0.817634568439388,0.838971190628671,0.842018661884877,0.829900260249477,0.829900260249922,0.829900260125238,0.829900260125236,0.829900260125237,0.829900260125235,0.829900260125238,0.829900260125236,0.829900260122934,0.829900260122536,0.830400000000000;1.14984893233834,1.14984893233875,1.14984893222457,1.14984893222457,1.14984893222457,1.14984893222456,1.14984893222457,1.14984893222456,1.14984893222246,1.14984893222209,121.337760966936,1.15040000000000,-38.7202982125482,-78.7417868007458,1.03929774870509,0.942109127637020,1.07105843213033,1.03094556115915,1.14183096525972,1.14182161855110,1.19219877242798,1.21389097609406,1.14984893245660,1.14984893245743,1.14984893222459,1.14984893222459,1.14984893222459,1.14984893222459,1.14984893222459,1.14984893222459,1.14984893222029,1.14984893221955,61.3542515950532,58.6722713862585,1.17991581498618,1.13006250926703,-38.0450231606727,-77.2316864276255,1.08822282545182,1.04855176025172,1.13569296282256,1.12594814368043,1.16751319342334,1.17350855294417,1.14984893246604,1.14984893246691,1.14984893222459,1.14984893222459,1.14984893222459,1.14984893222459,1.14984893222459,1.14984893222459,1.14984893222012,1.14984893221934,1.15040000000000;0.731339217301457,0.731339217301608,0.731339217259324,0.731339217259324,0.731339217259324,0.731339217259323,0.731339217259324,0.731339217259323,0.731339217258543,0.731339217258408,45.2381620961865,0.731968000000000,-14.0335024354421,-28.8548156810465,0.690712210162338,0.654704254784344,0.702474494649188,0.687602952070161,0.728671840881617,0.728669638157417,0.747327833399334,0.755307134380961,0.731339217357611,0.731339217357964,0.731339217259336,0.731339217259335,0.731339217259335,0.731339217259334,0.731339217259336,0.731339217259334,0.731339217257514,0.731339217257199,23.1000201748801,28.2283330102905,0.744358299668446,0.723232052669424,-15.8706201196393,-32.4694638944739,0.705381071612808,0.688623047515880,0.725518775403546,0.721392445440133,0.738999295098911,0.741508179828158,0.731339217428151,0.731339217428757,0.731339217259351,0.731339217259348,0.731339217259350,0.731339217259348,0.731339217259351,0.731339217259348,0.731339217256221,0.731339217255680,22.2537925842475;1.20966584000449,1.20966584000491,1.20966583988775,1.20966583988775,1.20966583988775,1.20966583988774,1.20966583988775,1.20966583988775,1.20966583988558,1.20966583988521,124.535702155628,1.20884475788539,-39.7013365871891,-80.7678328648408,1.09641787069499,0.996690000726245,1.12900788484676,1.08784601348362,1.20162718295527,1.20161771559307,1.25331045488551,1.27556376755162,1.20966584012705,1.20966584012791,1.20966583988777,1.20966583988777,1.20966583988777,1.20966583988777,1.20966583988777,1.20966583988777,1.20966583988334,1.20966583988257,62.9933832791735,60.8415279339172,1.24086160468323,1.18785816437848,-39.2130562695874,-79.6275068693903,1.14628222719357,1.10537270774679,1.19524264000589,1.18519263765076,1.22806004861774,1.23424024807377,1.20966584025370,1.20966584025501,1.20966583988780,1.20966583988779,1.20966583988780,1.20966583988779,1.20966583988780,1.20966583988779,1.20966583988102,1.20966583987984,39.1889125895364;0.624883419816749,0.624883419816861,0.624883419785448,0.624883419785447,0.624883419785447,0.624883419785446,0.624883419785447,0.624883419785447,0.624883419784867,0.624883419784767,33.6881951443085,0.625722884211461,-10.3440388254321,-21.3551287081834,0.594884667296085,0.568129339807406,0.603623196057495,0.592570409763203,0.623082559403722,0.623081259361258,0.636943344578770,0.642856900313418,0.624883419861769,0.624883419862043,0.624883419785457,0.624883419785456,0.624883419785456,0.624883419785455,0.624883419785457,0.624883419785456,0.624883419784042,0.624883419783797,17.2615222722215,22.7087468771046,0.635159305193492,0.618910877284965,-12.2667268950734,-25.1561024854243,0.604860470325707,0.591858237691518,0.620504886911028,0.617301030583860,0.630973276139115,0.632914318617344,0.624883419921056,0.624883419921542,0.624883419785470,0.624883419785467,0.624883419785469,0.624883419785467,0.624883419785469,0.624883419785467,0.624883419782955,0.624883419782521,18.7788171987399;1.25848893209654,1.25848893209696,1.25848893197792,1.25848893197792,1.25848893197792,1.25848893197791,1.25848893197792,1.25848893197792,1.25848893197572,1.25848893197534,126.567629193819,1.25786466272768,-40.3106600989895,-82.0379577756486,1.14356073429733,1.04222662619015,1.17667517661475,1.13484938842096,1.25046182338432,1.25045232509695,1.30297702912773,1.32558320563869,1.25848893222227,1.25848893222314,1.25848893197794,1.25848893197794,1.25848893197794,1.25848893197794,1.25848893197794,1.25848893197794,1.25848893197341,1.25848893197263,64.0423425027632,62.4475306762680,1.29048020255641,1.23642420635786,-40.0158571561595,-81.2819031214499,1.19389468981098,1.15212755834344,1.24388966474613,1.23362802944176,1.27739877715528,1.28370626109511,1.25848893235343,1.25848893235478,1.25848893197797,1.25848893197797,1.25848893197797,1.25848893197796,1.25848893197797,1.25848893197796,1.25848893197101,1.25848893196981,40.6293384678556;0.511474246824393,0.511474246824465,0.511474246804328,0.511474246804328,0.511474246804327,0.511474246804327,0.511474246804327,0.511474246804327,0.511474246803955,0.511474246803891,21.7046166460542,0.512450875622922,-6.51985359204175,-13.5784355047822,0.492426287212275,0.475269263984539,0.498028142317170,0.490936879116371,0.510498028253364,0.510497652038789,0.519384508557572,0.523155717755818,0.511474246857741,0.511474246857933,0.511474246804335,0.511474246804334,0.511474246804334,0.511474246804333,0.511474246804334,0.511474246804334,0.511474246803344,0.511474246803173,11.2019389856311,16.9181687470199,0.518814471041721,0.507646674194879,-8.51047571735887,-17.5310342229878,0.497568210751123,0.488482646611005,0.508526018174636,0.506284248251361,0.515852863946370,0.517201978880180,0.511474246905097,0.511474246905458,0.511474246804345,0.511474246804343,0.511474246804344,0.511474246804342,0.511474246804344,0.511474246804343,0.511474246802476,0.511474246802153,15.0908802141707;1.29574869398476,1.29574869398519,1.29574869386539,1.29574869386539,1.29574869386539,1.29574869386538,1.29574869386539,1.29574869386539,1.29574869386317,1.29574869386279,127.404508109891,1.29527965789427,-40.5388507795529,-82.5327114909540,1.18017798634099,1.07819502764709,1.21350399268820,1.17140944162886,1.28776084285701,1.28775140453114,1.34061182300306,1.36335723155725,1.29574869411248,1.29574869411337,1.29574869386541,1.29574869386541,1.29574869386541,1.29574869386541,1.29574869386541,1.29574869386541,1.29574869386083,1.29574869386004,64.4875899317542,63.4694547504531,1.32818652902463,1.27358680995919,-40.4422127025437,-82.1718753075633,1.23050284304733,1.18827083094572,1.28106236014231,1.27068557191131,1.31441806291936,1.32132356773494,1.29574869424695,1.29574869424832,1.29574869386544,1.29574869386544,1.29574869386544,1.29574869386544,1.29574869386544,1.29574869386544,1.29574869385837,1.29574869385715,41.6940454038900];
xbar0 = ones(2,55);
  1 Comment
Ali Esmaeilpour
Ali Esmaeilpour on 3 Jun 2019
it's MPC with N=5 as horizon so I think ubar and K dimension should be reduced and the primary numbers of K and ubar can be selected. and we don't need C because we are working from input to states. and x and u should not have same dimensions.

Sign in to comment.

Answers (0)

Categories

Find more on Model Predictive Control 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!