% Use for running lsqnonlin optimization
function f=f_lsq_high(x)

% Constants for function
L=0.0254;
N_pr=0.713;
P_0=99391;
Z_0=4.040044720327371e+002;
gamma=1.401;
rho_0=1.175039619433128e+000;
w=(3.147734574711181e+003:3.838700700867275e+001:4.022958334508924e+004)';
Zs_meas=[2.84540647165403 - 3.81520225683822i;2.43043554534693 - 3.59770970929828i;2.21345103494117 - 3.22979755284649i;2.22787262634794 - 3.08837530599756i;2.38220709958177 - 3.06274438405520i;2.50088313972841 - 2.95193675272713i;2.32092344392324 - 3.19668040702733i;2.26001083924405 - 2.99733802757563i;2.18158757180461 - 2.78694181853870i;1.83380661750613 - 2.72021959657963i;1.66025941715395 - 2.85019434378781i;2.03311292387095 - 2.82557102459149i;1.90874584297686 - 2.65093962997461i;1.70918655506966 - 2.36680392529191i;2.17860541616975 - 2.31817225919880i;2.05438147916553 - 1.95404994704120i;1.71252019417842 - 1.65995346986898i;1.59501331972117 - 1.92622924869030i;1.61958880881796 - 1.76510111450493i;1.99400903819995 - 1.78446781096342i;2.06848518955958 - 1.64336034248386i;1.75037320915930 - 1.49825977056958i;1.87394568413099 - 1.41275167056924i;1.64656915966233 - 1.63224694796058i;1.73045948074737 - 1.73092796121712i;1.77979712208385 - 1.65926566690078i;1.74893601315233 - 1.84814471389591i;1.78068545085783 - 1.47297526874367i;1.63484374293630 - 1.33410388824062i;1.51962473484977 - 1.50644416203688i;1.42031109819727 - 1.42740759060793i;1.70933393820583 - 1.63278148089853i;1.55613624212899 - 1.55546055635315i;1.53687496120658 - 1.38951021655412i;1.66736624959259 - 1.44101418745169i;1.78186865726703 - 1.51941599814095i;1.64850939854786 - 1.47419077057797i;1.44614718594125 - 1.29673829356409i;1.56613075576884 - 1.18789111547748i;1.61106648916514 - 1.13963169829028i;1.57127792362142 - 1.20890327342653i;1.48335830217470 - 1.32668688893005i;1.57150964402320 - 1.25265571380256i;1.58891438253328 - 1.07270240188101i;1.51244267139744 - 1.03013922680277i;1.45880084724801 - 1.04265652115541i;1.51944418449951 - 1.11454694167485i;1.48752777605547 - 1.07589144224608i;1.47381237906563 - 0.967155009763530i;1.46645767623210 - 0.939851036563304i;1.43534212936184 - 0.901012848853560i;1.43928487129977 - 0.893456508466471i;1.46820368231311 - 0.886077158686899i;1.44449072718693 - 0.846299418727364i;1.45272418844578 - 0.838687159473834i;1.45672477630610 - 0.819870636262111i;1.43670568582979 - 0.776844715221863i;1.44552705097078 - 0.757701785540163i;1.47639665991909 - 0.729301422015725i;1.46785081838110 - 0.702218543939974i;1.46733841694470 - 0.687904736556071i;1.46852551181994 - 0.666624733021782i;1.46741933420443 - 0.640847735445337i;1.46480919924587 - 0.593237091899990i;1.45617396420382 - 0.567488000877255i;1.45567507194900 - 0.558561917166327i;1.48627999527936 - 0.519872981702345i;1.48434548059500 - 0.519450998569460i;1.48346720145804 - 0.527944585557607i;1.48185669771198 - 0.500389384541277i;1.52237119259556 - 0.451808250940314i;1.54120601612844 - 0.432862890180839i;1.49852511906844 - 0.409802807298879i;1.52892260793262 - 0.404917430656923i;1.54318195065372 - 0.407837619264665i;1.55229649781214 - 0.367096409544417i;1.55595259224700 - 0.338097089549535i;1.56047557005652 - 0.351888323240821i;1.58133389156460 - 0.332487425666791i;1.59095820762587 - 0.402239204088947i;1.60804951688529 - 0.306388156016078i;1.62476067616770 - 0.320796776033603i;1.63883688803728 - 0.294201716872789i;1.59442055691221 - 0.225137282701888i;1.64193885500052 - 0.199177777371066i;1.67909187376573 - 0.289057205740181i;1.70255870200281 - 0.254108238739093i;1.71703812048925 - 0.233517502048252i;1.67318942545335 - 0.208033403208213i;1.66599712015258 - 0.150460528195718i;1.63504167061280 - 0.0964902840031014i;1.75597584761519 - 0.0426952747548877i;1.73578930548453 - 0.0937659214197027i;1.69620792948829 - 0.0683270891802822i;1.66327353676516 - 0.0220284461569486i;1.74202343285823 + 0.0196431361416669i;1.74691151457292 + 0.0654025921963908i;1.77327833737421 + 0.0592490607355586i;1.81163396349404 + 0.107083865187434i;1.77319960442086 + 0.123777058035407i;1.73429083320933 + 0.138250956189453i;1.76253678000077 + 0.157313780011553i;1.81775947923285 + 0.181548530900854i;1.82133547039791 + 0.175258174166639i;1.81204634465969 + 0.183426482352337i;1.87032680124085 + 0.146428897271114i;1.82490619805168 + 0.168174765757207i;1.90964742142360 + 0.152720990677670i;1.93397091409407 + 0.182765965741366i;1.89346834182893 + 0.181077525039151i;1.90447621791591 + 0.237890362991190i;2.00813066508854 + 0.260007778180645i;1.97536452373336 + 0.336106341349820i;2.03278527406479 + 0.365382988289349i;2.08590037864822 + 0.319132110696727i;2.11655496888245 + 0.290997917953934i;2.13475984363422 + 0.329505589723352i;2.19453973252279 + 0.314113764006854i;2.20747397842876 + 0.300514803361996i;2.21607398204692 + 0.387782003830973i;2.26722117963769 + 0.384141317871600i;2.24781734791996 + 0.476704574392791i;2.14311233141193 + 0.386093398948104i;2.22054309943945 + 0.348750170652412i;2.30294145619227 + 0.364386985597065i;2.30602341089031 + 0.418320976457402i;2.33352436869021 + 0.322167769708829i;2.50245732690598 + 0.492804733431883i;2.70707224720474 + 0.474541722931496i;2.80175128522050 + 0.353442161008695i;2.55994204471946 + 0.413199516851459i;2.64967664977340 + 0.417271027195404i;2.52662300480401 + 0.357171652034190i;2.74443169176319 + 0.633701746143411i;2.83513753131327 + 0.672563616248265i;2.91859635753305 + 0.321809484273336i;3.27009941660739 + 0.254419699409325i;3.30004873830891 + 0.420280449527019i;3.05102126894791 + 0.438157081802510i;3.21731623904448 + 0.681578919130562i;3.17647697945119 + 0.724921975973177i;2.95031145402497 + 0.534281128980376i;3.25028663572420 + 0.488855891851581i;3.45235737244631 + 0.369864128538962i;3.26208400984831 + 0.568058301787782i;3.12884589000171 + 0.458785193571556i;3.06253285155569 + 0.578073703278065i;2.95774757938434 + 0.631545345109523i;2.99499899790502 + 0.678759774064332i;2.93993945854475 + 0.731503427141632i;2.97640062390930 + 0.671690442365927i;3.04003217026307 + 0.649788693980443i;2.96527245079320 + 0.738047076873218i;3.01165355566533 + 0.659935308512875i;2.97686976360533 + 0.625687052626746i;2.91897052553030 + 0.710277481878174i;2.92449352824793 + 0.656708457166640i;2.89180913862292 + 0.612076869945311i;2.90688983831572 + 0.635206436820409i;2.94307463878101 + 0.600670286843201i;2.97910584040558 + 0.574380111501865i;2.99504618585571 + 0.624380338779765i;2.98109621907609 + 0.654631370201028i;3.03530838432281 + 0.616856571937862i;3.08289222522802 + 0.624380211108942i;3.05041731797219 + 0.591703479952028i;3.04632966492283 + 0.604326344186728i;3.05750752821471 + 0.600583956117657i;3.08983516909683 + 0.548468422479741i;3.17880309586691 + 0.530838642335566i;3.23534940544857 + 0.438685087967623i;3.25809415049277 + 0.462653532143680i;3.25003346028956 + 0.539770167612888i;3.23149753623083 + 0.574649072953156i;3.23684036023699 + 0.504651239951219i;3.24782393531066 + 0.506821670078852i;3.33077908546983 + 0.521566896051069i;3.35152675842120 + 0.489013905224747i;3.38273839947217 + 0.476801048480172i;3.38569591400712 + 0.464470092326164i;3.36231485322895 + 0.441744455018616i;3.36022252120723 + 0.447215108118823i;3.42325025732513 + 0.438700660059364i;3.44263769140450 + 0.414533411557903i;3.49757607808999 + 0.409117523883843i;3.57144476727214 + 0.357726943879966i;3.57063305669997 + 0.298368022405071i;3.53689245133983 + 0.291584295026013i;3.58939924388359 + 0.281378052796268i;3.64063883732920 + 0.245674147850744i;3.64249358342059 + 0.254392462825022i;3.64081570123011 + 0.243939151375312i;3.66291450276672 + 0.220771964284128i;3.68372582813228 + 0.221535831927032i;3.70643760808572 + 0.181226332263375i;3.73135183218487 + 0.152054828454663i;3.72829122949040 + 0.133842746783351i;3.77152165945972 + 0.166191621188835i;3.80742935509021 + 0.118624243182832i;3.81956041831938 + 0.0651221626926387i;3.81857460814419 + 0.0340432646638960i;3.85439455803285 - 0.000680421377429894i;3.85934118334943 + 0.00393647708686813i;3.85911504879398 + 0.00884372050812674i;3.90534024921823 - 0.0118804140994757i;3.91590188271774 - 0.0409422902225114i;3.93095155170042 - 0.0566026380156927i;3.92365657128579 - 0.0746677185592619i;3.91540057049726 - 0.137383226775836i;3.94083051821475 - 0.173881839177598i;3.94097605907185 - 0.173015256761720i;3.93858497357018 - 0.146753533111647i;3.97241879155661 - 0.198594242686457i;3.98833033251675 - 0.255943991353599i;3.99229568295253 - 0.253946076803018i;3.99380864838195 - 0.267082485250904i;4.02336720178290 - 0.312545823157309i;4.01846945913800 - 0.356133674282040i;3.97703340122696 - 0.359116598767178i;3.98361973865362 - 0.356484475152266i;3.98876653693067 - 0.382987642462165i;4.00674324652985 - 0.419061146939602i;4.02683682876804 - 0.454948397409546i;4.05096178352039 - 0.473775006653132i;4.03361990347715 - 0.482653076146244i;4.02117899858923 - 0.508511264296354i;4.01151423113530 - 0.510536617788176i;4.03930894747213 - 0.536945541068212i;4.01987871382176 - 0.545935224418857i;3.99261599998659 - 0.598848962684784i;4.02663886260563 - 0.636534746504422i;4.03415200519850 - 0.666767606110185i;4.04378383189196 - 0.666597774166905i;4.01317034180612 - 0.680101945846791i;4.01578926036837 - 0.697986720877735i;4.01592196868182 - 0.732542900015601i;4.00793852276192 - 0.743070733770406i;3.99005561254636 - 0.764799392481393i;4.00864427197016 - 0.780648926876422i;3.99088440750068 - 0.815668901522694i;3.95303289023106 - 0.812407525249494i;3.93358800589122 - 0.806435205278713i;3.93747762956956 - 0.828595299185402i;3.96432485290412 - 0.822658411957184i;3.95210599655510 - 0.910522036601840i;3.94320903286002 - 0.932973804092837i;3.93555183503694 - 0.948089063235413i;3.92918468030706 - 0.976299053181391i;3.91092868624448 - 0.963357193138411i;3.90389308300806 - 0.980106622574727i;3.88055530529437 - 1.00034766534983i;3.87070490164562 - 1.01180312779111i;3.88446570479823 - 1.00637595255047i;3.89165065296186 - 1.02562252930712i;3.88524658557746 - 1.03531307146099i;3.85081021514804 - 1.06409912177243i;3.80852735494876 - 1.09386435760495i;3.83096438351785 - 1.07539754713692i;3.85357415650901 - 1.08691500690809i;3.79167273125122 - 1.09648703740792i;3.79330348990940 - 1.10550263991437i;3.80528214312329 - 1.10570337985140i;3.77501814658175 - 1.14524708982194i;3.72263479664304 - 1.17786539461474i;3.74630291594429 - 1.19607174440971i;3.73700606387736 - 1.18015149362197i;3.72937134606650 - 1.17222387874050i;3.68650754602867 - 1.19037260631117i;3.67433604847734 - 1.23467619747324i;3.66484815102338 - 1.21913177575859i;3.68758768313534 - 1.20412169103354i;3.68209116895143 - 1.17762532657231i;3.66497817900885 - 1.23074454226988i;3.65715353835392 - 1.23712191714022i;3.63533009619069 - 1.24289509608597i;3.58207280022893 - 1.25470378932093i;3.61002594061906 - 1.27908414066817i;3.60489002525341 - 1.29258058627039i;3.63164568492262 - 1.27299576619904i;3.57777683834709 - 1.27933467641231i;3.57732266168571 - 1.31906477890768i;3.56424177638598 - 1.30277923844063i;3.51731669544891 - 1.28493204894586i;3.53202906137030 - 1.27042479692699i;3.52769012533677 - 1.26120104551281i;3.46521360333617 - 1.32106481493311i;3.46230291266541 - 1.33821435413663i;3.46415337949417 - 1.30365931953641i;3.49165353363881 - 1.27920953042646i;3.44894698560952 - 1.30452322676730i;3.46899038384950 - 1.34462459889659i;3.44165488887360 - 1.34332113887097i;3.40528752108241 - 1.31070226990103i;3.39634915122358 - 1.27569503916395i;3.39262873262312 - 1.25089094019162i;3.39778512151904 - 1.26811966521875i;3.38004988684825 - 1.26679569054861i;3.37505084910271 - 1.30067019530238i;3.39511158516338 - 1.27529499985118i;3.35403658734686 - 1.26502809024957i;3.32575978439614 - 1.28445839561249i;3.35613300157624 - 1.33096502975112i;3.33074970000318 - 1.33089463880299i;3.30477046239073 - 1.29891428536257i;3.31185343388804 - 1.32930929528072i;3.34454778276837 - 1.32415204637207i;3.31142102531262 - 1.30146352658218i;3.32390835813739 - 1.27995167133623i;3.31072416902074 - 1.28791728863909i;3.30696757625507 - 1.30483061503595i;3.26474650151167 - 1.30068983730776i;3.27187419589913 - 1.31882117956888i;3.25694230974786 - 1.31777909786366i;3.24542050707163 - 1.27349396610136i;3.24880237717238 - 1.28403434567701i;3.24057497756749 - 1.28115854022298i;3.27254022135519 - 1.26953325015917i;3.25379170617285 - 1.28824086310209i;3.23576904592850 - 1.29470424476579i;3.19549031738966 - 1.29697211357091i;3.18161928655264 - 1.29957624253552i;3.16869229676518 - 1.27139142222759i;3.20197639071632 - 1.27517727924662i;3.20503133017906 - 1.26071245254241i;3.18715716212310 - 1.26460481655627i;3.15176490884076 - 1.28757560190334i;3.15888969244309 - 1.26031761849951i;3.15400431888211 - 1.23582153802381i;3.15036408251606 - 1.27296715414885i;3.12643311457610 - 1.26025692097329i;3.12318158114200 - 1.26450717183139i;3.15331808254332 - 1.23130948392207i;3.15845704258047 - 1.21677932409001i;3.13622504364471 - 1.19958387476974i;3.13200577547616 - 1.20965515337197i;3.14216378520594 - 1.18898308397931i;3.09895562131158 - 1.19159049110602i;3.11153457376752 - 1.15957755605380i;3.09817167677110 - 1.18460725772492i;3.06075106320894 - 1.22664931967420i;3.06044708918349 - 1.21195094781489i;3.06540659517523 - 1.20833240950069i;3.04704024127334 - 1.20464817701157i;3.04048615312327 - 1.21215376445856i;3.05560800353245 - 1.17329888664464i;3.07288206621938 - 1.15412829155012i;3.04511307454042 - 1.15313979008155i;3.05275914611015 - 1.18553878170031i;3.04280014328454 - 1.17662542322047i;3.00797326844782 - 1.17734107450237i;2.98882577553338 - 1.14123008900838i;3.00069453405919 - 1.12838421492874i;3.03460998915174 - 1.13542760921521i;3.02259533796804 - 1.13782842628815i;2.97962844200242 - 1.14139923803054i;2.98271441479594 - 1.13290440893237i;2.97072505354116 - 1.11028641587601i;2.97605819835485 - 1.09604236747259i;2.98538439995517 - 1.11135682220604i;2.96613418396911 - 1.08338434834059i;2.96626088792576 - 1.08715233136713i;2.96814843675690 - 1.07850106475427i;2.94593529156364 - 1.07080659390625i;2.95672609816668 - 1.06867925433565i;2.95403546305739 - 1.06842377652826i;2.96342335049601 - 1.05365787101280i;2.94783064060331 - 1.04810390573137i;2.94211726003169 - 1.05710078963227i;2.93637334521868 - 1.06734681229167i;2.93536077853933 - 1.04229946072956i;2.89971345230374 - 1.03749558093616i;2.94781851554548 - 1.03945242164028i;2.96566367747846 - 1.03416018647221i;2.93612158211719 - 1.00238561439480i;2.91952858491363 - 0.980301205090100i;2.89537220071777 - 0.974275949556538i;2.89119752999017 - 1.00637231450075i;2.89965381301316 - 1.01205670243510i;2.91309759631084 - 0.969546045787149i;2.90410023754391 - 0.970608871508030i;2.91662146965376 - 0.973853197299074i;2.93257503236922 - 0.994127689078199i;2.90819562456562 - 0.988530719069275i;2.87104399601454 - 0.982971576985177i;2.87922735095537 - 0.975375783950284i;2.88937888108666 - 0.990959393178047i;2.89478057591814 - 0.982000608916448i;2.88942238517377 - 0.936610231113283i;2.86285731537274 - 0.937836939868169i;2.84960236187935 - 0.924633274838297i;2.86984305289083 - 0.910428769647355i;2.88178964567292 - 0.917542473585613i;2.88242359270097 - 0.926336792920774i;2.87359646662295 - 0.928668722916357i;2.85914595580733 - 0.928266422809763i;2.84649019624875 - 0.907750244313766i;2.83586716696432 - 0.898442302192486i;2.81907308622276 - 0.855023883537890i;2.84719614870163 - 0.857420667695460i;2.85961122170863 - 0.869157856740882i;2.87093033954499 - 0.888433758481369i;2.87810434844311 - 0.893749769432689i;2.88677614629494 - 0.874595733057020i;2.83626426940269 - 0.890042091283525i;2.82732705332474 - 0.936784276879377i;2.82304943662286 - 0.873679761414258i;2.84417885814438 - 0.838972802326927i;2.78258344203395 - 0.847441744181785i;2.79649792684003 - 0.836537859546110i;2.83280262687996 - 0.870849564053602i;2.87017867805886 - 0.831012478481235i;2.84718477653188 - 0.822921286170193i;2.82642869664697 - 0.814027675695322i;2.87616417852647 - 0.824990556001562i;2.85975626495190 - 0.838736744915187i;2.84066571910746 - 0.851200784048872i;2.84832896011541 - 0.825024038810619i;2.86276162618979 - 0.827881142338824i;2.90375524015305 - 0.790591827909002i;2.89197878977346 - 0.778807388413455i;2.87259011241108 - 0.772702216046159i;2.82530462035241 - 0.805618588253829i;2.83212789459930 - 0.798265464379390i;2.87347532323707 - 0.753739378036882i;2.83069988814502 - 0.803740870139372i;2.85018412127454 - 0.754607573945171i;2.86918029312577 - 0.733233214081540i;2.84002834144380 - 0.711657901681733i;2.82547390708880 - 0.753693060613386i;2.88205237950563 - 0.711513140408141i;2.86471149933864 - 0.735953117527234i;2.87712353090502 - 0.781264807009065i;2.89079222654836 - 0.807553475849429i;2.90624340410620 - 0.742975715498092i;2.87952817182238 - 0.733660107805491i;2.83144071304848 - 0.725391793157864i;2.83572310842591 - 0.692531874948430i;2.86556546847399 - 0.708272846536583i;2.89317788594574 - 0.749272816389969i;2.85053378430219 - 0.735819451286764i;2.80752333534614 - 0.707616369062202i;2.84634839502440 - 0.744109839137102i;2.84307752769028 - 0.740536765103596i;2.84984005532037 - 0.740122304939308i;2.81851370528078 - 0.715464925089244i;2.84044742779228 - 0.703197478633725i;2.89858354783050 - 0.674421180952146i;2.95364602840388 - 0.632099385416534i;2.95499569380876 - 0.660045136979553i;2.88841097968984 - 0.727224589489016i;2.88475769008218 - 0.766154531026260i;2.85344511456067 - 0.763523084030659i;2.87941710819688 - 0.677341672241236i;2.80995199595535 - 0.686237498230817i;2.78556809565680 - 0.682971023439849i;2.81263868072071 - 0.663164977581310i;2.81754975030507 - 0.685092793357277i;2.86613294896194 - 0.663402533610394i;2.84356514690974 - 0.668531773870575i;2.82524102022274 - 0.667671362117692i;2.86153897299547 - 0.681700967347515i;2.87405238657597 - 0.669657081580909i;2.85693966681159 - 0.618531302024009i;2.83861194767614 - 0.624094280843153i;2.82800790499056 - 0.637152725790318i;2.77937426976627 - 0.675448760515748i;2.80621082631781 - 0.685661631765096i;2.79012335563192 - 0.655248813071488i;2.81201353999190 - 0.634246251314405i;2.85479213980400 - 0.656095281977385i;2.87923394983303 - 0.677224268812941i;2.86165108531737 - 0.643097059470664i;2.81171090462528 - 0.634820869513484i;2.86537690001122 - 0.613314645766934i;2.87214696162796 - 0.582308856032887i;2.85821390907935 - 0.625904582253417i;2.83795639986733 - 0.656968601953226i;2.82343245461246 - 0.633930022493495i;2.82409262575038 - 0.620399005200835i;2.83192677593770 - 0.613677870668208i;2.82385322980580 - 0.613751711030040i;2.80066819171553 - 0.642030061993744i;2.79687026052125 - 0.668094355247527i;2.80931570574004 - 0.640386286023270i;2.79220906263308 - 0.614536006001196i;2.82197933030056 - 0.608724608166394i;2.79968357858296 - 0.631651416988938i;2.81501084743570 - 0.653279565155325i;2.83193969903747 - 0.634197212486928i;2.83692633211181 - 0.610424270639129i;2.82581502386489 - 0.611580890664325i;2.81571533015347 - 0.629474956213597i;2.81122569306760 - 0.614455645208021i;2.82588412121129 - 0.583927683320539i;2.81059369234372 - 0.596918131017900i;2.79285562515682 - 0.592878036754154i;2.82246458291528 - 0.599450317670048i;2.78919002352026 - 0.616892860979495i;2.76909216820942 - 0.616808672535076i;2.78366618988285 - 0.612901189617193i;2.76531879807696 - 0.591185303471553i;2.79057447236945 - 0.586071757275064i;2.78847537036836 - 0.592129937685346i;2.77830281602863 - 0.601867011964687i;2.78641356687279 - 0.570668167415893i;2.75950792256452 - 0.596994662977420i;2.77734311850549 - 0.603149495296020i;2.76674020796415 - 0.598858883750135i;2.74787403875253 - 0.604407573839006i;2.76641086293407 - 0.593059648887485i;2.77700349275472 - 0.580296231600535i;2.79062376272583 - 0.593451747875340i;2.75941405983401 - 0.590911678974747i;2.76445163267789 - 0.608012234996663i;2.74991881981735 - 0.607184066422008i;2.75419928527955 - 0.566913102445724i;2.73251220009033 - 0.562554936786721i;2.74151921895854 - 0.591792081967626i;2.77091108911687 - 0.591778766081783i;2.76097717557775 - 0.578092134286069i;2.74996965877686 - 0.592783187360800i;2.73912538366408 - 0.600928506294208i;2.73832443277877 - 0.588790802786239i;2.74011206218933 - 0.559228816814598i;2.74096939271410 - 0.574026962904332i;2.75178648561896 - 0.589243426614800i;2.74632799053760 - 0.567673856760132i;2.71347734517415 - 0.558841638350265i;2.73459106324555 - 0.562510361395310i;2.73416694074702 - 0.544014172270739i;2.76056860774731 - 0.547589706561015i;2.75780040546916 - 0.575019116153956i;2.72697885515410 - 0.577722941539657i;2.75503423589531 - 0.562536936159046i;2.75957766389877 - 0.545913902195246i;2.73988990638338 - 0.528711613119594i;2.74208569024038 - 0.547619131218770i;2.71773864486661 - 0.557742763843520i;2.72421612410964 - 0.568881324562077i;2.73556649241811 - 0.555561826918709i;2.73679402887360 - 0.530824390256051i;2.72920451583205 - 0.529694525112004i;2.72104479917572 - 0.535647712660141i;2.72849761222102 - 0.531899282047904i;2.72599094271166 - 0.549324818507882i;2.70762590485507 - 0.561811794271319i;2.67497814549666 - 0.559379147273859i;2.68373082768320 - 0.554438289218175i;2.70601180618699 - 0.544062049630570i;2.70109428435682 - 0.547671510073494i;2.69235063175870 - 0.538671745344631i;2.70367947119934 - 0.539830586911978i;2.69426896495118 - 0.551171832910300i;2.70250530133309 - 0.548170401896486i;2.69668088297068 - 0.507832542432909i;2.70776018292639 - 0.539575276505841i;2.68679290665498 - 0.551135586834076i;2.69447117287563 - 0.549391576106511i;2.71414250289524 - 0.517964325334636i;2.67370976663547 - 0.508725613152669i;2.67860923487337 - 0.517027206211838i;2.63372105220920 - 0.521936160959385i;2.63939527274197 - 0.528058704576063i;2.67764682225534 - 0.548979847536152i;2.64803792248978 - 0.557570641748010i;2.65558817982379 - 0.534766371027033i;2.68461939083807 - 0.546352727081996i;2.66600592652001 - 0.533436353662060i;2.67854678054793 - 0.518236362728497i;2.68247771925567 - 0.491989409974138i;2.68550921660079 - 0.532038601496455i;2.66331232121282 - 0.502095472956758i;2.64648080236443 - 0.514291438828326i;2.64610470304290 - 0.556688487801376i;2.65117993068974 - 0.552878626651033i;2.66443223819508 - 0.538673808765437i;2.64745760436669 - 0.531509283326864i;2.64497214135188 - 0.511287232621381i;2.63334553494906 - 0.507090127597717i;2.60858539918054 - 0.512845286877606i;2.62453987854748 - 0.514548688505887i;2.62720695284304 - 0.540051386148356i;2.63368595658349 - 0.544222271595732i;2.66112531403965 - 0.546307677316377i;2.64907733267355 - 0.534789122523844i;2.62573280583269 - 0.530409878141288i;2.63040878045844 - 0.519315370703076i;2.60694947004551 - 0.518728026515378i;2.60889365626413 - 0.515322542559378i;2.61502374413250 - 0.529069718622615i;2.61991098954415 - 0.495010296342983i;2.61117633182670 - 0.485613506743685i;2.60048838525785 - 0.536519277057097i;2.61039695714121 - 0.538345226439484i;2.61377610689459 - 0.525765069405339i;2.60692148728910 - 0.531048819162592i;2.60883557782323 - 0.531402435751928i;2.58659813065902 - 0.512300839180714i;2.57841279318130 - 0.509387188402593i;2.60244687045581 - 0.508505875870080i;2.58946831946985 - 0.500625114927205i;2.58147640731475 - 0.502160491743560i;2.61811329457815 - 0.513453937013374i;2.58920810944289 - 0.503256010093556i;2.60707986567631 - 0.489983708208734i;2.59360550518549 - 0.494540749797446i;2.58972214023673 - 0.498985035080585i;2.58332382109449 - 0.530032210582446i;2.58964673200880 - 0.549440314089714i;2.59593835438570 - 0.541701727177450i;2.58702251255186 - 0.530686787266165i;2.58815435553944 - 0.525386468377799i;2.56820365213947 - 0.528977729297757i;2.56223072762434 - 0.520494703714187i;2.56779244292689 - 0.486313996391359i;2.57559938451987 - 0.492353393904027i;2.54874412533762 - 0.513796939479820i;2.56053038514178 - 0.507408887828542i;2.54677617584120 - 0.500855379470368i;2.55119851145121 - 0.519290929333657i;2.55524790383068 - 0.506399692195862i;2.54967074400598 - 0.517937426616513i;2.53453619560354 - 0.514179272226793i;2.54293438820888 - 0.511668491546261i;2.55017310997412 - 0.519510787286610i;2.54114981801493 - 0.515002120659580i;2.54037469908758 - 0.515791698239140i;2.54767028104784 - 0.504249061566578i;2.54136754141475 - 0.505059722442736i;2.53891982919883 - 0.505551855730340i;2.53517620699269 - 0.510796992168356i;2.52892872378383 - 0.513016836511184i;2.52810383249052 - 0.517712529717468i;2.52443218106012 - 0.513994546939793i;2.53638036519174 - 0.510099307852801i;2.53828378180727 - 0.510696021047136i;2.52877589983043 - 0.512238148256573i;2.52207740781350 - 0.513024185867370i;2.52798756178012 - 0.495064517391892i;2.51730122561668 - 0.506334929252388i;2.50835575171661 - 0.507088105129816i;2.51843590824115 - 0.509627572451075i;2.51783505613447 - 0.521780606753386i;2.51397713503713 - 0.521559354032248i;2.51300402471004 - 0.519061114574246i;2.51264807063144 - 0.519340375421885i;2.50165797688105 - 0.518111503079857i;2.50579659193896 - 0.509679765935468i;2.50077608666389 - 0.506817285810663i;2.50940579363072 - 0.507368663255401i;2.50556498104446 - 0.510472641504152i;2.50007775008137 - 0.515228789611821i;2.49819687391671 - 0.508015966255523i;2.49468591742257 - 0.514398775358790i;2.49213375499687 - 0.510868721253624i;2.48774063563916 - 0.499865918581941i;2.49100256129079 - 0.517844072437699i;2.49241570318370 - 0.524749109486079i;2.48615995365150 - 0.509810942993305i;2.48991585918082 - 0.507260064172742i;2.48587889998007 - 0.526103125961930i;2.46159273915846 - 0.524587899486103i;2.45093438311857 - 0.519359115974339i;2.46655535575554 - 0.523337468866917i;2.48062841582354 - 0.512918844501436i;2.47511647446354 - 0.513621493281250i;2.47651936134616 - 0.524789504019008i;2.48411808887234 - 0.527054450485881i;2.47015852146102 - 0.516654727219444i;2.46985569576111 - 0.535483277760156i;2.48025777713118 - 0.532743240294675i;2.46621285443411 - 0.528075614822221i;2.44689058692070 - 0.544441097002035i;2.45192121841496 - 0.547289407444482i;2.44600314728893 - 0.531299396358844i;2.42111136646142 - 0.517877765390475i;2.42666480609892 - 0.518057430367294i;2.43442384997600 - 0.524766437174854i;2.44339964178499 - 0.555558926148446i;2.43350567371032 - 0.543129930749344i;2.41286445539575 - 0.543050457002874i;2.40802071143329 - 0.550216259906732i;2.41163436578521 - 0.551386020009204i;2.41990983920542 - 0.552890286727432i;2.40695001975410 - 0.542893811274138i;2.42919972947498 - 0.533367695926031i;2.41865348217690 - 0.513861460148884i;2.44017586016810 - 0.523915791195407i;2.41790986091217 - 0.512399653159597i;2.44556947699093 - 0.530935763649773i;2.42710536830934 - 0.535178755218622i;2.41477214710756 - 0.523241060326384i;2.43176991112505 - 0.530045424648292i;2.40837684311595 - 0.532902649835357i;2.40139453705045 - 0.520230625272333i;2.41694957747613 - 0.533051335444785i;2.45356721743869 - 0.490229208833614i;2.44757465936663 - 0.545895976627501i;2.42802040499331 - 0.588882895004751i;2.41752592666038 - 0.553541619930607i;2.40099478616986 - 0.556148561509707i;2.43266538719822 - 0.558212196513374i;2.40795952653451 - 0.588345210143960i;2.43790270675834 - 0.572601236449411i;2.41757287164461 - 0.541041488555366i;2.44668658817898 - 0.578342676412335i;2.43663443803875 - 0.546742096134306i;2.39122230147573 - 0.576234425856773i;2.40647659242505 - 0.606457533941967i;2.42342867004450 - 0.596478333714357i;2.43612132601396 - 0.595006121916034i;2.41175054500354 - 0.596921928295962i;2.39557878980794 - 0.615539679320577i;2.41015242593779 - 0.596537072521426i;2.40844400207791 - 0.559891142972637i;2.40370269890167 - 0.536868745081299i;2.37945012599775 - 0.497949990809816i;2.40993653756085 - 0.548683873921831i;2.40941205878018 - 0.563036970113835i;2.40064467846306 - 0.607198374029425i;2.40767189377663 - 0.593038316897748i;2.39141318789031 - 0.573952280145035i;2.38725956724641 - 0.586604853911589i;2.33096347530410 - 0.566648842962528i;2.36340997189440 - 0.571035320051496i;2.38875760044820 - 0.592201556687022i;2.34711864090329 - 0.605085181551818i;2.35160280721052 - 0.590344567294604i;2.35330084859997 - 0.602692047406023i;2.36260079816284 - 0.613033273919157i;2.33583240900511 - 0.610921769947287i;2.35038186168238 - 0.577077637012579i;2.32905247689054 - 0.580378779905027i;2.33611859145458 - 0.576876040452370i;2.35149473594448 - 0.596708220944936i;2.35808159829630 - 0.628094505919488i;2.32694566478954 - 0.634713936879878i;2.33970488167062 - 0.627199066260493i;2.34470559645690 - 0.624179781358106i;2.33641316262403 - 0.586859941291801i;2.34444899678012 - 0.587988832256165i;2.33557021926357 - 0.594858945712448i;2.33808434218064 - 0.595141722275066i;2.33799524837813 - 0.620847797839740i;2.29243284087353 - 0.615469813501648i;2.28563084746113 - 0.607951834281218i;2.31162525110334 - 0.619684073525086i;2.29794312117768 - 0.602751172428412i;2.31201263318792 - 0.591425469279172i;2.32410788738341 - 0.584173943118854i;2.31558021153373 - 0.596738524465099i;2.29744508461707 - 0.607902394304386i;2.30306181022344 - 0.600649869538528i;2.29674597964286 - 0.609051201435433i;2.31997092983319 - 0.605085998094268i;2.31103199823119 - 0.590822044018665i;2.28747333308468 - 0.607191354564369i;2.27504708478090 - 0.607599226306637i;2.28759428333412 - 0.606151816144982i;2.28365264852123 - 0.614891226291670i;2.25829350961289 - 0.600875662733917i;2.25479113848696 - 0.614759801533310i;2.28337026341742 - 0.596282249098932i;2.28500609170367 - 0.584796759636755i;2.28501036321067 - 0.599446961608878i;2.26744618443009 - 0.604558204331577i;2.27245571762800 - 0.608162281624555i;2.29191852115107 - 0.607368526079459i;2.29117335901288 - 0.610444724599338i;2.28346750131224 - 0.605577016932671i;2.27261873641221 - 0.605534986871655i;2.25752672440548 - 0.605199940379376i;2.25469539951571 - 0.613004523406145i;2.26786735298669 - 0.612344439664853i;2.27007865127706 - 0.614469049148489i;2.25462289352098 - 0.610487380432290i;2.25448969032009 - 0.626063257418591i;2.24965314130895 - 0.637049103700198i;2.25062208315912 - 0.623015974967899i;2.25603714000772 - 0.632356589756097i;2.25577197413616 - 0.613641639082006i;2.23689679624930 - 0.619010205252436i;2.23562218673769 - 0.621715646083021i;2.24563012780731 - 0.620068904288644i;2.22511964926781 - 0.623961080593251i;2.23546271867600 - 0.625799070573961i;2.23689066382865 - 0.630909002048523i;2.24198409742389 - 0.622158694202625i;2.24293858230128 - 0.626462646594078i;2.24139196216899 - 0.628459200644781i;2.23521023779622 - 0.629570703504957i;2.23207891503648 - 0.630359874690258i;2.21780989665182 - 0.612164426128990i;2.21623832782752 - 0.628179581752320i;2.21924920268965 - 0.617263002960697i;2.22087780687833 - 0.605373327231766i;2.20000450682550 - 0.626554545793750i;2.21405769291336 - 0.629696344437859i;2.21968778751781 - 0.638221935993521i;2.23318447702762 - 0.647206464764655i;2.22140538070235 - 0.648328219467797i;2.22343307710791 - 0.637777176065389i;2.21152058155185 - 0.625961580376238i;2.20994116539955 - 0.618783653417373i;2.21494878973659 - 0.615025857491796i;2.20596593982227 - 0.637277588951563i;2.21450604155635 - 0.637011170925436i;2.21396228631506 - 0.619995756185790i;2.21042526528202 - 0.635080513525271i;2.20686838892061 - 0.648003449014074i;2.21740710474497 - 0.632704540310382i;2.19828747095933 - 0.647934053065272i;2.18404673121431 - 0.653074368287631i;2.18359795292746 - 0.640773236128593i;2.18495993850716 - 0.628445559172295i;2.18027032059538 - 0.632890157333863i;2.19260289933537 - 0.645035502776727i;2.18610004109430 - 0.643032801665315i;2.20041757075254 - 0.657308145769140i;2.19466043338357 - 0.632646094691276i;2.19674739456785 - 0.630473465489526i;2.20945142902749 - 0.650421827804407i;2.18791840393212 - 0.636826185775464i;2.18798005466588 - 0.606419596514655i;2.19258347281164 - 0.623307661375660i;2.18348525586153 - 0.635614779034083i;2.19234209367273 - 0.629048694266464i;2.19677736609292 - 0.639813562482969i;2.18292040904080 - 0.624201923644025i;2.16678190257676 - 0.627210063092270i;2.15699527758934 - 0.637268740585743i;2.14375230024854 - 0.642742695959755i;2.15577736231761 - 0.650551832210552i;2.16636705775737 - 0.634995084614685i;2.16035333918138 - 0.633547001234750i;2.16040259498762 - 0.632288107430253i;2.15596570056413 - 0.621704640188409i;2.16990335410843 - 0.629147666415439i;2.16318269823835 - 0.638329275162870i;2.18033421080305 - 0.647842205520597i;2.16933492507495 - 0.635991431980463i;2.16039458032369 - 0.623089057699180i;2.16246380559339 - 0.645901208481892i;2.17390004694424 - 0.668047453806198i;2.17937927229649 - 0.651112207244647i;2.14728887537881 - 0.639026402099127i;2.13603816831885 - 0.638235796988156i;2.15913176984747 - 0.640476169589791i;2.16833079142402 - 0.635080085862630i;2.16638114471748 - 0.635650340364345i;2.15733128403742 - 0.653921658141662i;2.16456981521491 - 0.657840655477915i;2.16068052248000 - 0.617945001165761i;2.15502585688348 - 0.664159662744811i;2.15033835192788 - 0.688598689860622i;2.14382479553097 - 0.668981553957255i;2.14067196107792 - 0.637741742237209i;2.11950807038185 - 0.626961942925232i;2.10684109251584 - 0.651373949026531i;2.12024896919540 - 0.659552471834948i;2.12860479983214 - 0.663507299326773i;2.15736759578014 - 0.619296220772290i;2.15485885946208 - 0.645627732599912i;2.12773978505199 - 0.656411808393963i;2.12471388755477 - 0.644012705470412i;2.14111186027071 - 0.640185867669789i;2.13825397039617 - 0.648605821401070i;2.12031566999568 - 0.657157641346255i;2.10642032953284 - 0.651412172479332i;2.13210080700248 - 0.672904949129867i;2.12538055176656 - 0.666805406741521i;2.13235210897179 - 0.671186725776373i;2.12803630576121 - 0.663979522113338i;2.12962916666964 - 0.658831126238034i;2.12453886925298 - 0.631273295445771i;2.12947549899066 - 0.630876328615998i;2.14198598150449 - 0.646940095804199i;2.13504065741006 - 0.657982119252713i;2.12442735048047 - 0.662493900248160i;2.11057845504842 - 0.627066621416186i;2.13150955993737 - 0.642735939515334i;2.13603959524186 - 0.648717226050658i;2.11304073256700 - 0.641149147111454i;2.13134178249898 - 0.655731263449664i;2.12962413708600 - 0.637604778364253i;2.13936981590269 - 0.635461229453509i;2.14265288472461 - 0.650663885361142i;2.12164691134832 - 0.650815283137707i;2.11254974990104 - 0.675065271208497i;2.11928604593247 - 0.648485787234779i;2.12009794800608 - 0.638287527193592i;2.11206535606224 - 0.628062777677108i;2.12436371648867 - 0.640033613648173i;2.11952607425624 - 0.660302443863812i;2.11202705415885 - 0.651931782077256i;2.11686844185321 - 0.659103001641551i;2.11719074720353 - 0.653879745706350i;2.12901235535784 - 0.653255011294937i;2.12412204997173 - 0.647974716309582i;2.11361102313030 - 0.648511675163481i;2.11349201351181 - 0.640539361945077i;2.09712300161485 - 0.649434028983770i;2.10214908224185 - 0.634173959201810i;2.11613225390807 - 0.635703316913054i;2.10890442421653 - 0.645610234593017i;2.11480747357595 - 0.650678166527543i;2.11449571220131 - 0.635715841951568i;2.10491611319291 - 0.634954973568271i;2.10322130890231 - 0.635581745005324i;2.10460876813356 - 0.646711654286146i;2.10331816273396 - 0.635791462218133i;2.10523129253279 - 0.643888899392675i;2.09810001134541 - 0.642956162153599i;2.08178415404746 - 0.648414511682139i;2.07452517885143 - 0.638089957778641i;2.08108756932869 - 0.643605954465734i;2.08640091620886 - 0.664275825627080i;2.09125518420370 - 0.650007651221057i;2.09571818233084 - 0.643190742861770i;2.09180191618810 - 0.646075682620632i;2.10687831923569 - 0.632383456923973i;2.09972738462176 - 0.623726864515789i;2.07838037335281 - 0.621900200426727i;2.07704748732286 - 0.642448448658666i;2.07645178470550 - 0.642364621638703i;2.07912018512443 - 0.633713142571029i;2.07411919778432 - 0.648733270249291i;2.07951131717388 - 0.659455698622198i;2.06984062292912 - 0.639213269733590i;2.06605193821821 - 0.636840677149594i;2.07584180290961 - 0.631158723157309i;2.07309402211422 - 0.641083918873989i;2.06847074240332 - 0.638631590317492i;2.07503006283535 - 0.652303324412193i;2.08071399775633 - 0.642965597700669i;2.08052498833635 - 0.619960217653261i;2.07136054783952 - 0.633273683212748i;2.05734886578987 - 0.632094592803015i;2.05252356331393 - 0.653687878634060i;2.05642427746708 - 0.655084459197706i;2.05852931684363 - 0.645699981293718i;2.03952807249842 - 0.635717601045016i;2.05621191531494 - 0.622136282028484i;2.06919709931212 - 0.622904017793476i;2.06557723009041 - 0.631103919724726i;2.05820796340747 - 0.640199921648473i;2.04806678614477 - 0.628788346069698i;2.06549608613398 - 0.627974782403056i;2.05835041802309 - 0.643033258880813i;2.05908318899344 - 0.627237810572994i;2.05613376397326 - 0.620699786981618i;2.03472292450079 - 0.615437023268597i;2.04277827174444 - 0.631628106458227i;2.04155293643648 - 0.630780227379573i;2.04873969981995 - 0.600739207199166i;2.05253244378980 - 0.604668542412295i;2.03728397827401 - 0.609201785846730i;2.02479556202509 - 0.616830620351700i;2.03621627450800 - 0.628832741124706i;2.03036148778673 - 0.631259735474139i;2.03752085004556 - 0.626960832534069i;2.02050895349646 - 0.633930468921905i;2.00645295477766 - 0.597646024237620i;2.03599259433761 - 0.614615364378893i;2.01413383486233 - 0.646568205239641i;2.03335164174612 - 0.630425486461807i;2.03974196868154 - 0.619069487605555i];

% If none of the Zone sections are uncommented, the function will be
% computed over all three frequency zones

%% Use for Zone I Only
% Zs_meas2=Zs_meas(1:42);
% w2=w(1:42);
% clear Zs_meas w
% Zs_meas=Zs_meas2;
% w=w2;

%% Use for Zone II Only
% Zs_meas2=Zs_meas(43:246);
% w2=w(43:246);
% clear Zs_meas w
% Zs_meas=Zs_meas2;
% w=w2;

%% Use for Zone III Only
% Zs_meas2=Zs_meas(247:end);
% w2=w(247:end);
% clear Zs_meas w
% Zs_meas=Zs_meas2;
% w=w2;

%% Use for Zone I and II Only
% Zs_meas2=Zs_meas(1:246);
% w2=w(1:246);
% clear Zs_meas w
% Zs_meas=Zs_meas2;
% w=w2;

%% Function Computation
K=gamma*P_0*(gamma-(gamma-1)./(1+(x(1)*x(2)*(x(5)*x(4)-0.1*x(5)+0.1))./(j*w*N_pr*rho_0*x(3)).*sqrt(1+(j*w*N_pr*rho_0*x(3))/(2*x(1)*x(2)*(x(5)*x(4)-0.1*x(5)+0.1))))).^(-1);
rho=rho_0*x(3)*(1+(x(2)*x(1))./(j*w*rho_0*x(3)).*sqrt(1+(j*w*rho_0*x(3)*x(4))/(2*x(1)*x(2))));
Zc=sqrt(rho.*K);
kc=w.*sqrt(rho./K);
Zs=-j*Zc/(x(2)*Z_0).*cot(kc*L);
f=abs(Zs-Zs_meas);
end