How to set boundary for solutions in vpasolve?

1 次查看(过去 30 天)
Hello. i would like to get soutions for phi_e between 1.3 radians and 1.57 radians, and for phi_g between 0 radians and 1.57 radians. How do I set boundary in vpasolve?
clc
clear
Tp = 1 ;
Tg = 1.3 ;
Te = 1 ;
Vp = 480 ;
Vg = 587 * ( Tp / Tg ) ; % 587 678
Lp = 22e-6 ;
Lg = 22e-6 ;
Le = 101e-6 ;
Lpg = Lp + Lg + ( Lp * Lg / Le ) ;
Lge = Lg + Le + ( Lg * Le / Lp ) ;
Lpe = Lp + Le + ( Lp * Le / Lg ) ;
w = 2 * pi * 100e3 ;
Pp = 4000 ;
i = 0 ;
for V_ev = 5 : 5 : 800
i = i + 1 ;
Ve = V_ev * ( Tp / Te ) ;
syms phi_e phi_g real
Ppg = ( Vp * Vg / ( w * Lpg ) ) * phi_g * ( 1 - ( phi_g / pi ) ) ;
Ppe = ( 8 / pi^2 ) * ( Vp * Ve / ( w * Lpe ) ) * sin( pi - phi_e ) ;
Pge = ( 8 / pi^2 ) * ( Vg * Ve / ( w * Lge ) ) * sin( pi - phi_e - phi_g ) ;
Pe = -( V_ev / 800 ) * Pp ;
Pg = -Pp - Pe ;
Pe_eq = -Ppe - Pge == Pe ;
Pg_eq = -Ppg + Pge == Pg ;
Solution = vpasolve( [ Pe_eq, Pg_eq ] ) ;
Ppg = ( Vp * Vg / ( w * Lpg ) ) * Solution.phi_g * ( 1 - ( Solution.phi_g / pi ) ) ;
Ppe = ( 8 / pi^2 ) * ( Vp * Ve / ( w * Lpe ) ) * sin( pi - Solution.phi_e ) ;
Pge = ( 8 / pi^2 ) * ( Vg * Ve / ( w * Lge ) ) * sin( pi - Solution.phi_e - Solution.phi_g ) ;
Solution_phi_e(i) = Solution.phi_e * 180 / 3.14159 ;
Solution_phi_g(i) = Solution.phi_g * 180 / 3.14159 ;
P_ev(i) = -Ppe - Pge ;
P_grid(i) = -Ppg + Pge ;
clear phi_e
clear phi_g
end
figure(1)
plot( P_grid, Solution_phi_e, 'o' )
hold on
plot( P_grid, Solution_phi_g, 'o' )
hold on
grid on

采纳的回答

Walter Roberson
Walter Roberson 2023-12-1
编辑:Walter Roberson 2023-12-1
There does not appear to be a solution between 1.3 and pi/2 radians.
Tp = 1 ;
Tg = 1.3 ;
Te = 1 ;
Vp = 480 ;
Vg = 587 * ( Tp / Tg ) ; % 587 678
Lp = 22e-6 ;
Lg = 22e-6 ;
Le = 101e-6 ;
Lpg = Lp + Lg + ( Lp * Lg / Le ) ;
Lge = Lg + Le + ( Lg * Le / Lp ) ;
Lpe = Lp + Le + ( Lp * Le / Lg ) ;
w = 2 * pi * 100e3 ;
Pp = 4000 ;
i = 0 ;
for V_ev = 5 : 5 : 800
i = i + 1 ;
Ve = V_ev * ( Tp / Te ) ;
syms phi_e phi_g real
Ppg = ( Vp * Vg / ( w * Lpg ) ) * phi_g * ( 1 - ( phi_g / pi ) ) ;
Ppe = ( 8 / pi^2 ) * ( Vp * Ve / ( w * Lpe ) ) * sin( pi - phi_e ) ;
Pge = ( 8 / pi^2 ) * ( Vg * Ve / ( w * Lge ) ) * sin( pi - phi_e - phi_g ) ;
Pe = -( V_ev / 800 ) * Pp ;
Pg = -Pp - Pe ;
Pe_eq = -Ppe - Pge == Pe ;
Pg_eq = -Ppg + Pge == Pg ;
Solution = vpasolve( [ Pe_eq, Pg_eq ], [phi_e, phi_g], [0 pi/2; 0 pi/2] )
Ppg = ( Vp * Vg / ( w * Lpg ) ) * Solution.phi_g * ( 1 - ( Solution.phi_g / pi ) ) ;
Ppe = ( 8 / pi^2 ) * ( Vp * Ve / ( w * Lpe ) ) * sin( pi - Solution.phi_e ) ;
Pge = ( 8 / pi^2 ) * ( Vg * Ve / ( w * Lge ) ) * sin( pi - Solution.phi_e - Solution.phi_g ) ;
Solution_phi_e(i) = Solution.phi_e * 180 / 3.14159 ;
Solution_phi_g(i) = Solution.phi_g * 180 / 3.14159 ;
P_ev(i) = -Ppe - Pge ;
P_grid(i) = -Ppg + Pge ;
clear phi_e
clear phi_g
end
Solution = struct with fields:
phi_e: 1.1680765218022624384351742176511 phi_g: 0.73678279050110385032294217461889
Solution = struct with fields:
phi_e: 1.1573811287916347877658258152486 phi_g: 0.73343310769631451594164313614058
Solution = struct with fields:
phi_e: 1.1489934805101289486482969604201 phi_g: 0.7301185474684451051398601049778
Solution = struct with fields:
phi_e: 1.1419925513909991360379662558623 phi_g: 0.72683429090088589061664593890402
Solution = struct with fields:
phi_e: 1.1359441239261626944996207528574 phi_g: 0.72357723435202320601303435794529
Solution = struct with fields:
phi_e: 1.1306021941620429600210993243574 phi_g: 0.7203451251759711711331792832282
Solution = struct with fields:
phi_e: 1.12581130533771109956185581713 phi_g: 0.7171362114659475756074372172751
Solution = struct with fields:
phi_e: 1.1214657596871351109019162151413 phi_g: 0.71394906802672936013492750505352
Solution = struct with fields:
phi_e: 1.1174898012826569979793418250916 phi_g: 0.7107824982769485301521196981218
Solution = struct with fields:
phi_e: 1.1138269257515632395184507536125 phi_g: 0.70763547392330830732523526835071
Solution = struct with fields:
phi_e: 1.110433650327861336292783152777 phi_g: 0.70450709540873463441720917062738
Solution = struct with fields:
phi_e: 1.1072756602492201318904674109357 phi_g: 0.7013965646711267751878027618365
Solution = struct with fields:
phi_e: 1.1043253090983124603629209114698 phi_g: 0.69830316563218202706583531157917
Solution = struct with fields:
phi_e: 1.1015599332278988166261857474468 phi_g: 0.69522624977028975097324831278499
Solution = struct with fields:
phi_e: 1.0989606777936754513703923082797 phi_g: 0.6921652251666628316326708509057
Solution = struct with fields:
phi_e: 1.0965116564250695638729731578028 phi_g: 0.68911954800074785056984593570259
Solution = struct with fields:
phi_e: 1.0941993354256744306325988441982 phi_g: 0.68608871581996937251571149401289
Solution = struct with fields:
phi_e: 1.0920120732242786042947946844044 phi_g: 0.68307226212495371793699974081184
Solution = struct with fields:
phi_e: 1.0899397697341694711834313202389 phi_g: 0.68006975194985567738178297518021
Solution = struct with fields:
phi_e: 1.0879735951493880901003848243887 phi_g: 0.6770807782088374389979427241482
Solution = struct with fields:
phi_e: 1.0861057772176229046212780094807 phi_g: 0.67410495864170363963993895389227
Solution = struct with fields:
phi_e: 1.0843294322704394670355818131459 phi_g: 0.67114193323465528438314075589982
Solution = struct with fields:
phi_e: 1.0826384294812900055190103486868 phi_g: 0.66819136202252853204818536215961
Solution = struct with fields:
phi_e: 1.0810272806925564019291680165446 phi_g: 0.66525292320079762567392455544845
Solution = struct with fields:
phi_e: 1.0794910501565109427220562450988 phi_g: 0.66232631149167860008119312032903
Solution = struct with fields:
phi_e: 1.0780252799570043854973734216851 phi_g: 0.65941123672061268695448834446141
Solution = struct with fields:
phi_e: 1.0766259279032659529046327100018 phi_g: 0.6565074225684127255824833459048
Solution = struct with fields:
phi_e: 1.0752893154357951471968319285967 phi_g: 0.65361460547122752453262345384123
Solution = struct with fields:
phi_e: 1.074012083638261829803349116295 phi_g: 0.65073253364578579720978515597753
Solution = struct with fields:
phi_e: 1.0727911558641084074542484108647 phi_g: 0.64786096622152130935442148328389
Solution = struct with fields:
phi_e: 1.0716237058005201872625260501506 phi_g: 0.6449996724644410210009102984394
Solution = struct with fields:
phi_e: 1.0705071300324687527805800700387 phi_g: 0.64214843108019059906364622911867
Solution = struct with fields:
phi_e: 1.0694390243547843296214164438265 phi_g: 0.63930702958584995355544617294618
Solution = struct with fields:
phi_e: 1.0684171632244956482122381297934 phi_g: 0.63647526374166794570247509200848
Solution = struct with fields:
phi_e: 1.0674394818588319057015886555711 phi_g: 0.63365293703531292626635525125909
Solution = struct with fields:
phi_e: 1.0665040605738971966491015089822 phi_g: 0.63083986021233244009594824508171
Solution = struct with fields:
phi_e: 1.0656091110303070026214921153333 phi_g: 0.62803585084743913931190185267867
Solution = struct with fields:
phi_e: 1.0647529641093368396425999009225 phi_g: 0.62524073295200337547950319134253
Solution = struct with fields:
phi_e: 1.0639340591892892138904763899662 phi_g: 0.62245433661377171792955703050302
Solution = struct with fields:
phi_e: 1.0631509346292842290320258464664 phi_g: 0.61967649766536557977030959070631
Solution = struct with fields:
phi_e: 1.0624022192983245263823477410676 phi_g: 0.61690705737856375154866476357554
Solution = struct with fields:
phi_e: 1.0616866250125948262141300976156 phi_g: 0.61414586218175559872378848956475
Solution = struct with fields:
phi_e: 1.061002939764716869962890636425 phi_g: 0.6113927633982760095439611235247
Solution = struct with fields:
phi_e: 1.0603500216459008601218681272708 phi_g: 0.60864761700360916258477897978747
Solution = struct with fields:
phi_e: 1.0597267933762281799364820452103 phi_g: 0.60591028339968820067557381480422
Solution = struct with fields:
phi_e: 1.0591322373703155041628506814219 phi_g: 0.60318062720472087319708618742861
Solution = struct with fields:
phi_e: 1.0585653912756801329300343438199 phi_g: 0.6004585170571489625425024465636
Solution = struct with fields:
phi_e: 1.0580253439296190155296505437787 phi_g: 0.59774382543250238121310131603406
Solution = struct with fields:
phi_e: 1.0575112316875960811189382107977 phi_g: 0.5950364284720434397023533917577
Solution = struct with fields:
phi_e: 1.057022235082283582337007540947 phi_g: 0.59233620582221073644097779067968
Solution = struct with fields:
phi_e: 1.0565575757775666211244066382237 phi_g: 0.58964304048397800758590729597315
Solution = struct with fields:
phi_e: 1.0561165137863209550687240336203 phi_g: 0.5869568186713291792048184776379
Solution = struct with fields:
phi_e: 1.0556983449245852112029512425207 phi_g: 0.58427742967813215234054178780132
Solution = struct with fields:
phi_e: 1.0553023984780482522416178463774 phi_g: 0.58160476575276255377032147428327
Solution = struct with fields:
phi_e: 1.0549280350596137182847239162885 phi_g: 0.57893872197989083687077371647451
Solution = struct with fields:
phi_e: 1.0545746446392871767189512798153 phi_g: 0.5762791961689001450451429859806
Solution = struct with fields:
phi_e: 1.054241644729744413599770788958 phi_g: 0.57362608874845205149894063194067
Solution = struct with fields:
phi_e: 1.0539284787128277118258781161231 phi_g: 0.57097930266676009913902243502199
Solution = struct with fields:
phi_e: 1.0536346142938292648986248709126 phi_g: 0.56833874329716962124105760164889
Solution = struct with fields:
phi_e: 1.0533595420718488279016046705286 phi_g: 0.56570431834867810070294517151714
Solution = struct with fields:
phi_e: 1.0531027742157647669139623949734 phi_g: 0.56307593778105975388944960711148
Solution = struct with fields:
phi_e: 1.0528638432364396100263402325763 phi_g: 0.56045351372428866150098668271129
Solution = struct with fields:
phi_e: 1.0526423008467727329238579198338 phi_g: 0.55783696040197699570265661740843
Solution = struct with fields:
phi_e: 1.052437716902037001631760357207 phi_g: 0.55522619405857034326587883947305
Solution = struct with fields:
phi_e: 1.0522496784137170754156233369908 phi_g: 0.55262113289006092791548517100777
Solution = struct with fields:
phi_e: 1.0520777886307191817977485650705 phi_g: 0.55002169697799910564672376676347
Solution = struct with fields:
phi_e: 1.0519216661824241791235453621999 phi_g: 0.54742780822660000550606729337711
Solution = struct with fields:
phi_e: 1.0517809442785735945931968295887 phi_g: 0.54483939030275832142668609699032
Solution = struct with fields:
phi_e: 1.0516552699614705688776640251784 phi_g: 0.54225636857879692995515233736293
Solution = struct with fields:
phi_e: 1.0515443034063769673437067081852 phi_g: 0.53967867007778893491676814279544
Solution = struct with fields:
phi_e: 1.0514477172663699805415980062479 phi_g: 0.53710622342130415846492342670656
Solution = struct with fields:
phi_e: 1.0513651960582679533636598369177 phi_g: 0.53453895877944121458105342570384
Solution = struct with fields:
phi_e: 1.0512964355865285146490165406685 phi_g: 0.53197680782301638832169225175029
Solution = struct with fields:
phi_e: 1.0512411424022891544799981811841 phi_g: 0.52941970367778998245587677810571
Solution = struct with fields:
phi_e: 1.0511990332949836793994668786029 phi_g: 0.52686758088061776302599853215137
Solution = struct with fields:
phi_e: 1.0511698348141639827828159628822 phi_g: 0.52432037533742390334578219117321
Solution = struct with fields:
phi_e: 1.0511532828193789016463872556243 phi_g: 0.52177802428289817557256473574264
Solution = struct with fields:
phi_e: 1.0511491220561213367648165815796 phi_g: 0.51924046624182622430648061901046
Solution = struct with fields:
phi_e: 1.0511571057560344200634335477499 phi_g: 0.51670764099196847552964015724438
Solution = struct with fields:
phi_e: 1.0511769952597063221396659218302 phi_g: 0.5141794895284075026930893970744
Solution = struct with fields:
phi_e: 1.0512085596605142664718845289658 phi_g: 0.51165595402929038270877158017178
Solution = struct with fields:
phi_e: 1.0512515754681098277980458116298 phi_g: 0.50913697782289486569143720463696
Solution = struct with fields:
phi_e: 1.0513058262902418108337041139906 phi_g: 0.50662250535595497987815191488538
Solution = struct with fields:
phi_e: 1.0513711025317088941505636443422 phi_g: 0.5041124821631839507883448961775
Solution = struct with fields:
phi_e: 1.051447201109342577212113169873 phi_g: 0.50160685483793638859704070709763
Solution = struct with fields:
phi_e: 1.0515339251819847720693435245871 phi_g: 0.49910557100395575126360450216691
Solution = struct with fields:
phi_e: 1.0516310838945165279023943932874 phi_g: 0.4966085792881553663490612458188
Solution = struct with fields:
phi_e: 1.0517384921350540508894926128137 phi_g: 0.4941158292943851803529284672571
Solution = struct with fields:
phi_e: 1.0518559703045003803168378527526 phi_g: 0.49162727157813853311458990422904
Solution = struct with fields:
phi_e: 1.051983344097695634998461855259 phi_g: 0.48914285762215549129339623009033
Solution = struct with fields:
phi_e: 1.0521204442954608589717154323867 phi_g: 0.48666253981288335661052171945644
Solution = struct with fields:
phi_e: 1.0522671065668892167135032887605 phi_g: 0.48418627141775463117794582979221
Solution = struct with fields:
phi_e: 1.0524231712812680992762749842045 phi_g: 0.48171400656324767460110873509599
Solution = struct with fields:
phi_e: 1.0525884833290773356328774729354 phi_g: 0.47924570021369442851614646484422
Solution = struct with fields:
phi_e: 1.052762891951530230394678080064 phi_g: 0.47678130815080387698848692119475
Solution = struct with fields:
phi_e: 1.0529462505781660125502797554787 phi_g: 0.47432078695387029683875484700295
Solution = struct with fields:
phi_e: 1.0531384166720432297663736999982 phi_g: 0.47186409398063645196058164146973
Solution = struct with fields:
phi_e: 1.0533392515821000206868864859407 phi_g: 0.46941118734878522011954747905524
Solution = struct with fields:
phi_e: 1.0535486204022830841377394863505 phi_g: 0.4669620259180329887918508127286
Solution = struct with fields:
phi_e: 1.0537663918370721536163107165191 phi_g: 0.46451656927280013384093044286522
Solution = struct with fields:
phi_e: 1.0539924380730552920467213422487 phi_g: 0.46207477770543456319312565581637
Solution = struct with fields:
phi_e: 1.0542266346562183553811159743142 phi_g: 0.45963661219996663476760243201432
Solution = struct with fields:
phi_e: 1.0544688603746506829324374909499 phi_g: 0.45720203441637380001690309462834
Solution = struct with fields:
phi_e: 1.0547189971463766213677730996228 phi_g: 0.45477100667533454700634331210862
Solution = struct with fields:
phi_e: 1.0549769299120437624954589626719 phi_g: 0.45234349194345256379011310149793
Solution = struct with fields:
phi_e: 1.0552425465322133312421093980492 phi_g: 0.44991945381893293106501653939554
Solution = struct with fields:
phi_e: 1.0555157376890178601479995250572 phi_g: 0.44749885651769272950702343930552
Solution = struct with fields:
phi_e: 1.0557963967919606395154519801651 phi_g: 0.44508166485988914497150051990842
Solution = struct with fields:
phi_e: 1.0560844198876490713670103252522 phi_g: 0.44266784425684969327399376633543
Solution = struct with fields:
phi_e: 1.0563797055732636245902961712143 phi_g: 0.44025736069838891079103051413976
Solution = struct with fields:
phi_e: 1.056682154913574665779394824156 phi_g: 0.4378501807404978027811655135823
Solution = struct with fields:
phi_e: 1.0569916713613351800935032060947 phi_g: 0.43544627149339118398625946601605
Solution = struct with fields:
phi_e: 1.0573081606808822177577718947606 phi_g: 0.43304560060990079592129537636771
Solution = struct with fields:
phi_e: 1.0576315308747921132319538112523 phi_g: 0.43064813627420117671297518387421
Solution = struct with fields:
phi_e: 1.0579616921134432820919437997942 phi_g: 0.42825384719085582455518486003569
Solution = struct with fields:
phi_e: 1.0582985566673457833379691343995 phi_g: 0.425862702574173237100394807653
Solution = struct with fields:
phi_e: 1.0586420388421114803640633026315 phi_g: 0.4234746721378605454231879719995
Solution = struct with fields:
phi_e: 1.0589920549159345971703133747747 phi_g: 0.4210897260849654148216511909743
Solution = struct with fields:
phi_e: 1.0593485230794717709623826583831 phi_g: 0.41870783509809543273457270828679
Solution = struct with fields:
phi_e: 1.0597113633780087905846759474395 phi_g: 0.41632897032990511159409098011524
Solution = struct with fields:
phi_e: 1.0600804976558075848244896518733 phi_g: 0.41395310339384229415113156093291
Solution = struct with fields:
phi_e: 1.0604558495025389174028508630593 phi_g: 0.4115802063551441141179227171551
Solution = struct with fields:
phi_e: 1.0608373442016996892291776143058 phi_g: 0.40921025172207457484360664848865
Solution = struct with fields:
phi_e: 1.0612249086809382139562700881387 phi_g: 0.4068432124373952206110333014844
Solution = struct with fields:
phi_e: 1.0616184714641884325265154652204 phi_g: 0.40447906187006149665583774506509
Solution = struct with fields:
phi_e: 1.0620179626255450856200412253994 phi_g: 0.40211777380713727073499083498845
Solution = struct with fields:
phi_e: 1.0624233137447974128508398338152 phi_g: 0.39975932244591972297218376155933
Solution = struct with fields:
phi_e: 1.0628344578645551488571061987319 phi_g: 0.39740368238626865330613148668869
Solution = struct with fields:
phi_e: 1.0632513294488881365707227748402 phi_g: 0.39505082862313308082374175238653
Solution = struct with fields:
phi_e: 1.0636738643434323990039943636667 phi_g: 0.39270073653926824294461894047611
Solution = struct with fields:
phi_e: 1.0641019997368786746680948818732 phi_g: 0.39035338189813833789932916225512
Solution = struct with fields:
phi_e: 1.0645356741238070590776505452925 phi_g: 0.38800874083699727796980713467192
Solution = struct with fields:
phi_e: 1.0649748272687951552801214012168 phi_g: 0.38566678986014343867937788666296
Solution = struct with fields:
phi_e: 1.0654194001717535540897816654072 phi_g: 0.38332750583234205454482017315273
Solution = struct with fields:
phi_e: 1.0658693350344434276492973194346 phi_g: 0.38099086597241012119704824485643
Solution = struct with fields:
phi_e: 1.0663245752281154683056101435624 phi_g: 0.37865684784695900153424297364885
Solution = struct with fields:
phi_e: 1.0667850652622373379052497577997 phi_g: 0.37632542936429001239204250400018
Solution = struct with fields:
phi_e: 1.0672507507542576038762182964972 phi_g: 0.3739965887684375856540235281046
Solution = struct with fields:
phi_e: 1.0677215784003695570515552031829 phi_g: 0.37167030463335650526506062234473
Solution = struct with fields:
phi_e: 1.0681974959472296063769868761501 phi_g: 0.36934655585724823799079901367189
Solution = struct with fields:
phi_e: 1.068678452164602695420594487557 phi_g: 0.36702532165702225494412504273081
Solution = struct with fields:
phi_e: 1.0691643968188854391280840384149 phi_g: 0.36470658156288845952844659297867
Solution = struct with fields:
phi_e: 1.0696552806474839717220532724955 phi_g: 0.36239031541307718543756503164755
Solution = struct with fields:
phi_e: 1.0701510553340074842486278285455 phi_g: 0.36007650334868195709167239774934
Solution = struct with fields:
phi_e: 1.0706516734842499259809458796368 phi_g: 0.35776512580862254865939309565203
Solution = struct with fields:
phi_e: 1.0711570886029224383334779760929 phi_g: 0.3554561635247245644737307381822
Solution = struct with fields:
phi_e: 1.071667255071121858415867408642 phi_g: 0.35314959751691145937950128912523
Solution = struct with fields:
phi_e: 1.072182128124492435743308441891 phi_g: 0.35084540908850683488269036586437
Solution = struct with fields:
phi_e: 1.0727016638320636862853283484829 phi_g: 0.34854357982164324911196534378841
Solution = struct with fields:
phi_e: 1.0732258190757396697121279109942 phi_g: 0.34624409157277441957715954500171
Solution = struct with fields:
phi_e: 1.0737545515304102837049038857331 phi_g: 0.34394692646828833392247973356143
Solution = struct with fields:
phi_e: 1.0742878196446672751779536663077 phi_g: 0.34165206690021836122763252890446
Solution = struct with fields:
phi_e: 1.0748255826220998863354712761645 phi_g: 0.33935949552204907940213522226946
Solution = struct with fields:
phi_e: 1.0753678004031500425187315757651 phi_g: 0.33706919524461500651586610138999
Solution = struct with fields:
phi_e: 1.0759144336475055266721470191019 phi_g: 0.33478114923208912527468284153682
Solution = struct with fields:
phi_e: 1.0764654437170164205564136144947 phi_g: 0.33249534089805913900100575771173
Solution = struct with fields:
phi_e: 1.0770207926591105533200512613852 phi_g: 0.33021175390168826069491263220142
Solution = struct with fields:
phi_e: 1.0775804431906950611790245393533 phi_g: 0.3279303721439595902001861436543
Solution = struct with fields:
phi_e: 1.0781443586825221058432639111648 phi_g: 0.32565117976400046755061095241732
Solution = struct with fields:
phi_e: 1.0787125031440087263887653042485 phi_g: 0.32337416113548572284327913468019
figure(1)
plot( P_grid, Solution_phi_e, 'o' )
hold on
plot( P_grid, Solution_phi_g, 'o' )
hold on
grid on
  2 个评论
Walter Roberson
Walter Roberson 2023-12-1
If you convert the question into a residue problem, and look to see how close you can get to equalities in the desired range, then:
  • up to about 20 you don't get all that good of a fit... the equalities aren't so bad but cannot be met
  • for a stretch up to 300 you can get pretty good fits -- you might even be able to get complete fits in that range
  • above 300 the fit is awful. There is no possibility of bounded solutions in that range.
Tp = 1 ;
Tg = 1.3 ;
Te = 1 ;
Vp = 480 ;
Vg = 587 * ( Tp / Tg ) ; % 587 678
Lp = 22e-6 ;
Lg = 22e-6 ;
Le = 101e-6 ;
Lpg = Lp + Lg + ( Lp * Lg / Le ) ;
Lge = Lg + Le + ( Lg * Le / Lp ) ;
Lpe = Lp + Le + ( Lp * Le / Lg ) ;
w = 2 * pi * 100e3 ;
Pp = 4000 ;
i = 0 ;
opts = optimoptions('ga','PopulationSize', 1000, 'display', 'none');
syms phi_e phi_g real
for V_ev = 5 : 5 : 800
i = i + 1 ;
Ve = V_ev * ( Tp / Te ) ;
Ppg = ( Vp * Vg / ( w * Lpg ) ) * phi_g * ( 1 - ( phi_g / pi ) ) ;
Ppe = ( 8 / pi^2 ) * ( Vp * Ve / ( w * Lpe ) ) * sin( pi - phi_e ) ;
Pge = ( 8 / pi^2 ) * ( Vg * Ve / ( w * Lge ) ) * sin( pi - phi_e - phi_g ) ;
Pe = -( V_ev / 800 ) * Pp ;
Pg = -Pp - Pe ;
Pe_eq = -Ppe - Pge == Pe ;
Pg_eq = -Ppg + Pge == Pg ;
residue = (lhs(Pe_eq)-rhs(Pe_eq)).^2 + (lhs(Pg_eq)-rhs(Pg_eq)).^2;
residuefun = matlabFunction(residue, 'vars', {[phi_e, phi_g]});
%Solution = vpasolve( [ Pe_eq, Pg_eq ], [phi_e, phi_g], [0 pi/2; 0 pi/2] )
V_ev
[sol, fval] = ga(residuefun, 2, [], [], [], [], [1.3, 0], [pi/2, pi/2], [], opts)
Solution.phi_e = sol(1); Solution.phi_g = sol(2);
Ppg = ( Vp * Vg / ( w * Lpg ) ) * Solution.phi_g * ( 1 - ( Solution.phi_g / pi ) ) ;
Ppe = ( 8 / pi^2 ) * ( Vp * Ve / ( w * Lpe ) ) * sin( pi - Solution.phi_e ) ;
Pge = ( 8 / pi^2 ) * ( Vg * Ve / ( w * Lge ) ) * sin( pi - Solution.phi_e - Solution.phi_g ) ;
Solution_phi_e(i) = Solution.phi_e * 180 / 3.14159 ;
Solution_phi_g(i) = Solution.phi_g * 180 / 3.14159 ;
P_ev(i) = -Ppe - Pge ;
P_grid(i) = -Ppg + Pge ;
end
V_ev = 5
sol = 1×2
1.3000 0.7366
fval = 0.0042
V_ev = 10
sol = 1×2
1.3000 0.7331
fval = 0.0077
V_ev = 15
sol = 1×2
1.3000 0.7295
fval = 0.0050
V_ev = 20
sol = 1×2
1.3000 0.7260
fval = 1.8774e-04
V_ev = 25
sol = 1×2
1.3080 0.7225
fval = 1.6746e-09
V_ev = 30
sol = 1×2
1.3165 0.7190
fval = 8.1659e-05
V_ev = 35
sol = 1×2
1.3254 0.7154
fval = 8.0804e-06
V_ev = 40
sol = 1×2
1.3336 0.7119
fval = 2.7331e-07
V_ev = 45
sol = 1×2
1.3411 0.7084
fval = 6.9068e-07
V_ev = 50
sol = 1×2
1.3484 0.7049
fval = 1.5483e-07
V_ev = 55
sol = 1×2
1.3554 0.7014
fval = 5.5855e-07
V_ev = 60
sol = 1×2
1.3620 0.6979
fval = 7.4919e-07
V_ev = 65
sol = 1×2
1.3686 0.6944
fval = 3.4418e-06
V_ev = 70
sol = 1×2
1.3748 0.6909
fval = 5.1967e-07
V_ev = 75
sol = 1×2
1.3808 0.6874
fval = 3.7773e-05
V_ev = 80
sol = 1×2
1.3868 0.6839
fval = 3.3821e-06
V_ev = 85
sol = 1×2
1.3926 0.6805
fval = 4.1011e-07
V_ev = 90
sol = 1×2
1.3982 0.6770
fval = 3.5205e-06
V_ev = 95
sol = 1×2
1.4036 0.6736
fval = 1.7050e-05
V_ev = 100
sol = 1×2
1.4090 0.6702
fval = 1.4859e-06
V_ev = 105
sol = 1×2
1.4142 0.6667
fval = 4.3000e-09
V_ev = 110
sol = 1×2
1.4193 0.6633
fval = 8.3486e-06
V_ev = 115
sol = 1×2
1.4243 0.6599
fval = 5.0934e-06
V_ev = 120
sol = 1×2
1.4292 0.6565
fval = 6.0148e-05
V_ev = 125
sol = 1×2
1.4341 0.6532
fval = 6.6339e-06
V_ev = 130
sol = 1×2
1.4387 0.6498
fval = 1.3759e-05
V_ev = 135
sol = 1×2
1.4434 0.6464
fval = 3.8949e-07
V_ev = 140
sol = 1×2
1.4480 0.6431
fval = 3.2178e-05
V_ev = 145
sol = 1×2
1.4524 0.6398
fval = 1.5518e-05
V_ev = 150
sol = 1×2
1.4569 0.6365
fval = 5.6745e-06
V_ev = 155
sol = 1×2
1.4612 0.6331
fval = 1.5991e-06
V_ev = 160
sol = 1×2
1.4655 0.6298
fval = 1.2040e-05
V_ev = 165
sol = 1×2
1.4697 0.6266
fval = 3.7664e-06
V_ev = 170
sol = 1×2
1.4738 0.6233
fval = 1.7455e-05
V_ev = 175
sol = 1×2
1.4779 0.6200
fval = 2.7230e-08
V_ev = 180
sol = 1×2
1.4819 0.6168
fval = 7.4803e-08
V_ev = 185
sol = 1×2
1.4859 0.6135
fval = 1.0742e-05
V_ev = 190
sol = 1×2
1.4898 0.6103
fval = 9.2235e-06
V_ev = 195
sol = 1×2
1.4937 0.6071
fval = 4.3956e-05
V_ev = 200
sol = 1×2
1.4975 0.6039
fval = 5.1001e-06
V_ev = 205
sol = 1×2
1.5012 0.6007
fval = 9.9978e-08
V_ev = 210
sol = 1×2
1.5050 0.5975
fval = 2.4083e-06
V_ev = 215
sol = 1×2
1.5086 0.5943
fval = 4.5817e-06
V_ev = 220
sol = 1×2
1.5122 0.5911
fval = 1.8811e-06
V_ev = 225
sol = 1×2
1.5158 0.5880
fval = 7.7451e-06
V_ev = 230
sol = 1×2
1.5194 0.5848
fval = 1.8663e-08
V_ev = 235
sol = 1×2
1.5229 0.5817
fval = 2.8952e-06
V_ev = 240
sol = 1×2
1.5263 0.5786
fval = 1.1824e-05
V_ev = 245
sol = 1×2
1.5297 0.5755
fval = 5.5343e-05
V_ev = 250
sol = 1×2
1.5331 0.5724
fval = 1.2926e-07
V_ev = 255
sol = 1×2
1.5364 0.5693
fval = 1.3217e-06
V_ev = 260
sol = 1×2
1.5397 0.5662
fval = 5.2154e-06
V_ev = 265
sol = 1×2
1.5430 0.5632
fval = 2.0059e-06
V_ev = 270
sol = 1×2
1.5462 0.5601
fval = 2.6079e-05
V_ev = 275
sol = 1×2
1.5494 0.5571
fval = 2.6953e-06
V_ev = 280
sol = 1×2
1.5526 0.5540
fval = 1.4483e-07
V_ev = 285
sol = 1×2
1.5557 0.5510
fval = 1.4169e-07
V_ev = 290
sol = 1×2
1.5588 0.5480
fval = 5.3308e-06
V_ev = 295
sol = 1×2
1.5619 0.5450
fval = 8.0416e-05
V_ev = 300
sol = 1×2
1.5649 0.5420
fval = 5.3032e-06
V_ev = 305
sol = 1×2
1.5680 0.5390
fval = 1.4433e-06
V_ev = 310
sol = 1×2
1.5708 0.5360
fval = 0.0026
V_ev = 315
sol = 1×2
1.5708 0.5333
fval = 1.3997
V_ev = 320
sol = 1×2
1.5708 0.5307
fval = 5.4797
V_ev = 325
sol = 1×2
1.5708 0.5280
fval = 12.4154
V_ev = 330
sol = 1×2
1.5708 0.5253
fval = 22.3803
V_ev = 335
sol = 1×2
1.5708 0.5227
fval = 35.5480
V_ev = 340
sol = 1×2
1.5708 0.5200
fval = 52.0924
V_ev = 345
sol = 1×2
1.5708 0.5174
fval = 72.1875
V_ev = 350
sol = 1×2
1.5708 0.5148
fval = 96.0072
V_ev = 355
sol = 1×2
1.5708 0.5122
fval = 123.7257
V_ev = 360
sol = 1×2
1.5708 0.5096
fval = 155.5169
V_ev = 365
sol = 1×2
1.5708 0.5070
fval = 191.5543
V_ev = 370
sol = 1×2
1.5708 0.5044
fval = 232.0113
V_ev = 375
sol = 1×2
1.5708 0.5019
fval = 277.0608
V_ev = 380
sol = 1×2
1.5708 0.4993
fval = 326.8754
V_ev = 385
sol = 1×2
1.5708 0.4968
fval = 381.6271
V_ev = 390
sol = 1×2
1.5708 0.4943
fval = 441.4873
V_ev = 395
sol = 1×2
1.5708 0.4918
fval = 506.6267
V_ev = 400
sol = 1×2
1.5708 0.4893
fval = 577.2153
V_ev = 405
sol = 1×2
1.5708 0.4868
fval = 653.4230
V_ev = 410
sol = 1×2
1.5708 0.4843
fval = 735.4176
V_ev = 415
sol = 1×2
1.5708 0.4818
fval = 823.3672
V_ev = 420
sol = 1×2
1.5708 0.4794
fval = 917.4384
V_ev = 425
sol = 1×2
1.5708 0.4769
fval = 1.0178e+03
V_ev = 430
sol = 1×2
1.5708 0.4745
fval = 1.1246e+03
V_ev = 435
sol = 1×2
1.5708 0.4720
fval = 1.2380e+03
V_ev = 440
sol = 1×2
1.5708 0.4696
fval = 1.3582e+03
V_ev = 445
sol = 1×2
1.5708 0.4672
fval = 1.4854e+03
V_ev = 450
sol = 1×2
1.5708 0.4648
fval = 1.6196e+03
V_ev = 455
sol = 1×2
1.5708 0.4624
fval = 1.7611e+03
V_ev = 460
sol = 1×2
1.5708 0.4600
fval = 1.9101e+03
V_ev = 465
sol = 1×2
1.5708 0.4577
fval = 2.0666e+03
V_ev = 470
sol = 1×2
1.5708 0.4553
fval = 2.2308e+03
V_ev = 475
sol = 1×2
1.5708 0.4529
fval = 2.4029e+03
V_ev = 480
sol = 1×2
1.5708 0.4506
fval = 2.5830e+03
V_ev = 485
sol = 1×2
1.5708 0.4482
fval = 2.7714e+03
V_ev = 490
sol = 1×2
1.5708 0.4459
fval = 2.9680e+03
V_ev = 495
sol = 1×2
1.5708 0.4436
fval = 3.1732e+03
V_ev = 500
sol = 1×2
1.5708 0.4413
fval = 3.3870e+03
V_ev = 505
sol = 1×2
1.5708 0.4389
fval = 3.6095e+03
V_ev = 510
sol = 1×2
1.5708 0.4366
fval = 3.8410e+03
V_ev = 515
sol = 1×2
1.5708 0.4344
fval = 4.0815e+03
V_ev = 520
sol = 1×2
1.5708 0.4321
fval = 4.3313e+03
V_ev = 525
sol = 1×2
1.5708 0.4298
fval = 4.5904e+03
V_ev = 530
sol = 1×2
1.5708 0.4275
fval = 4.8589e+03
V_ev = 535
sol = 1×2
1.5708 0.4253
fval = 5.1371e+03
V_ev = 540
sol = 1×2
1.5708 0.4230
fval = 5.4250e+03
V_ev = 545
sol = 1×2
1.5708 0.4208
fval = 5.7228e+03
V_ev = 550
sol = 1×2
1.5708 0.4185
fval = 6.0307e+03
V_ev = 555
sol = 1×2
1.5708 0.4163
fval = 6.3486e+03
V_ev = 560
sol = 1×2
1.5708 0.4141
fval = 6.6769e+03
V_ev = 565
sol = 1×2
1.5708 0.4118
fval = 7.0155e+03
V_ev = 570
sol = 1×2
1.5708 0.4096
fval = 7.3647e+03
V_ev = 575
sol = 1×2
1.5708 0.4074
fval = 7.7245e+03
V_ev = 580
sol = 1×2
1.5708 0.4052
fval = 8.0950e+03
V_ev = 585
sol = 1×2
1.5708 0.4030
fval = 8.4765e+03
V_ev = 590
sol = 1×2
1.5708 0.4008
fval = 8.8689e+03
V_ev = 595
sol = 1×2
1.5708 0.3987
fval = 9.2724e+03
V_ev = 600
sol = 1×2
1.5708 0.3965
fval = 9.6872e+03
V_ev = 605
sol = 1×2
1.5708 0.3943
fval = 1.0113e+04
V_ev = 610
sol = 1×2
1.5708 0.3922
fval = 1.0551e+04
V_ev = 615
sol = 1×2
1.5708 0.3900
fval = 1.1000e+04
V_ev = 620
sol = 1×2
1.5708 0.3878
fval = 1.1461e+04
V_ev = 625
sol = 1×2
1.5708 0.3857
fval = 1.1933e+04
V_ev = 630
sol = 1×2
1.5708 0.3836
fval = 1.2418e+04
V_ev = 635
sol = 1×2
1.5708 0.3814
fval = 1.2914e+04
V_ev = 640
sol = 1×2
1.5708 0.3793
fval = 1.3423e+04
V_ev = 645
sol = 1×2
1.5708 0.3772
fval = 1.3943e+04
V_ev = 650
sol = 1×2
1.5708 0.3751
fval = 1.4476e+04
V_ev = 655
sol = 1×2
1.5708 0.3730
fval = 1.5021e+04
V_ev = 660
sol = 1×2
1.5708 0.3709
fval = 1.5579e+04
V_ev = 665
sol = 1×2
1.5708 0.3688
fval = 1.6149e+04
V_ev = 670
sol = 1×2
1.5708 0.3667
fval = 1.6732e+04
V_ev = 675
sol = 1×2
1.5708 0.3646
fval = 1.7328e+04
V_ev = 680
sol = 1×2
1.5708 0.3625
fval = 1.7936e+04
V_ev = 685
sol = 1×2
1.5708 0.3604
fval = 1.8557e+04
V_ev = 690
sol = 1×2
1.5708 0.3584
fval = 1.9191e+04
V_ev = 695
sol = 1×2
1.5708 0.3563
fval = 1.9838e+04
V_ev = 700
sol = 1×2
1.5708 0.3542
fval = 2.0499e+04
V_ev = 705
sol = 1×2
1.5708 0.3522
fval = 2.1172e+04
V_ev = 710
sol = 1×2
1.5708 0.3501
fval = 2.1859e+04
V_ev = 715
sol = 1×2
1.5708 0.3481
fval = 2.2559e+04
V_ev = 720
sol = 1×2
1.5708 0.3461
fval = 2.3272e+04
V_ev = 725
sol = 1×2
1.5708 0.3440
fval = 2.3999e+04
V_ev = 730
sol = 1×2
1.5708 0.3420
fval = 2.4740e+04
V_ev = 735
sol = 1×2
1.5708 0.3400
fval = 2.5494e+04
V_ev = 740
sol = 1×2
1.5708 0.3379
fval = 2.6261e+04
V_ev = 745
sol = 1×2
1.5708 0.3359
fval = 2.7043e+04
V_ev = 750
sol = 1×2
1.5708 0.3339
fval = 2.7838e+04
V_ev = 755
sol = 1×2
1.5708 0.3319
fval = 2.8647e+04
V_ev = 760
sol = 1×2
1.5708 0.3299
fval = 2.9469e+04
V_ev = 765
sol = 1×2
1.5708 0.3279
fval = 3.0306e+04
V_ev = 770
sol = 1×2
1.5708 0.3259
fval = 3.1157e+04
V_ev = 775
sol = 1×2
1.5708 0.3239
fval = 3.2021e+04
V_ev = 780
sol = 1×2
1.5708 0.3219
fval = 3.2900e+04
V_ev = 785
sol = 1×2
1.5708 0.3199
fval = 3.3793e+04
V_ev = 790
sol = 1×2
1.5708 0.3180
fval = 3.4700e+04
V_ev = 795
sol = 1×2
1.5708 0.3160
fval = 3.5621e+04
V_ev = 800
sol = 1×2
1.5708 0.3140
fval = 3.6556e+04
figure(1)
plot( P_grid, Solution_phi_e, 'o' )
hold on
plot( P_grid, Solution_phi_g, 'o' )
hold on
grid on

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Particle & Nuclear Physics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by