How to get a minimal realization of the syms based expressions?
11 views (last 30 days)
Show older comments
I have a transfer function as a function of s, which is defined as syms real. The problem is the expression I am getting from the symbolic calculation has very high power terms in numerator as well as in denominator. I do not need this much accuracy, and the expression can be made simpler. Is there a command in MATLAB that simplifies the expression mentioned below?
syms s real
TF = (16071372659616720348971165081004999648428177131661336835975212808174464104804932302273170494400847127597471245991117983298776585372267605539421056970196558807040000000000000000000000000000000000000000*s^5 + (- 242040933688860740963017955938206167689205806810799895194579139633348633363148457292647724688859995874055843157769570116746395007464765077369064723508328499261136703586304000000000000000000000000000000000*pi - 273706690585303535838114923591098568716625861433319921324980916211195316270195058278787099255624989777205169329599000245812964809573508978520602295196999348734419030507520000000000000000000000000000000000)*s^4 + (- 46046386334592754449684641625611365662407190966846780488855579349463485023752196478854771034419613492485868378161112436946965087591825377218567679925220504672772135321600000000000000000000000000*pi^2 - 2919273489978646456137479461825674175321620045036048000713014419645180448788724137692719397970573615988302698306935824184053480212015839324787851318355433299251993892968396979856998400000000000000000000000000000*pi + 12751044145783038240412150546864936978018955670583565308941311126612494667602551074089317024684243784583102955500404231734398598739750898808939724733136830058777720567019271073300480000000000000000000000000000000)*s^3 + (- 6994982983608074543086416528837199779512693623275457008758579189057252761550517483051917891993733608164675893111609389809339103656576832022159148091981405116852246977330941201538392983324160163840000000000000000000*pi^3 + 1978684319950689554340962234378513245531044274917382515293320644863406191275447010694412635954833379769570453836701920501637342277085886238755386482050167300406688307694252327826874139662929100800000000000000000000*pi^2 - 72062282376436226538254790580472608226171912678264357886760014205950714590681985511614759872182678771846406869651561940402101441562215348971766433044728512786858306019635106696647881774858240000000000000000000000000*pi - 63106015898524940053166357750191813435699809160809415369933831787833872960140145010060301474749027445832722935819740275313656502606171956021649392950150281007507717504823036595879709297868800000000000000000000000000)*s^2 + (- 13422971159038478991586100715894355361392675292619777339190202229295673752296582178236474231994847771631490666896486668712932493339405061526791789522445466414479276603834135555240438909148200007908292820992000000000000000*pi^4 - 84360082246506355086284484588450011384062639871198681238833455812387587995017653071032638714778902653163010963412352113195511841635405434056644935137634548335877922191259986028241740628376790343995675901952000000000000000*pi^3 + 368523924980504399721415926535882739561782673508313853784860278306183557107923676636631906717821803317565442594883509961309147675832503094910326858540220462006973370989496268932981608777929390115454829199360000000000000000*pi^2 + 1935757834976279570379458894861459524881747462871668949259464010836568536815506705729860933086166855068820496055633140342621953706106250256745018113613714615601779209135221211580323071578987298816000000000000000000000*pi + 1307247592911054735089828707843772556841031898001520796649335234015271964985767163271544276037430592433227356727537041958108673330048120714424758236374272288138014674870222942958425218228007818693181440000000000000000000000)*s + 10703302095513206226442301041443451136175358974760555193390188635902501530715796911609956946099437259458420115525965773733756670752750041078903850686290039211611589965102630474530591106252884969438954137426329600000000000000000*pi - 2461275291567629909715031614813888050836132428440394466898831863214824302645954751068612295842596465348588073956342192382028879064942343712528872607757544148212459689618718675058696797282315108233186601334466412544000000000000*pi^2 - 1999123003772242822016337080237618503023289838672119576561319378083765901686508072530045661481949850642513372781187257955882783421878768616866225271757117496225517704043122533383170490154260797946010848959257798246400000000000*pi^3 + 312350901991332518581238727427651648648196607399667657205212460151948362142863492737379409753328776494964370266415099964634772360672982027006237933104420100519240260723753537634479894537748510028323802429180503654400000000000*pi^4 + 646785046625462900954530969184842632528894769379138627140960950998016182246814766764516391494124581829571324929541375309269542701534677872452151498044059402908638053962916203616963494175615275460254201020416000000000000000000)/(48984409560824263706010871398400*(2654979486630579215662965246751627247072347342565346333042114808333042275840861824791284204833429881529181941464469718131340414402075111865997314453125*s^8 + 32557120063445092725156027893871611579281408513080669022459917635047348005891739929272608963649486986924961242263060480000000000000000000000000000000000000*s^7 + (230186721490871204557690705599120979955984941972243682979626747979919737500840506038996164187287231790112597617206820822584543045222400000000000000000000000000000*pi^2 + 4971078497436533680082628755431673015705404850983483363418954261251914872400943568396157063787648535934322961718128928487965070458880000000000000000000000000000000)*s^6 + (1941175452197981089008569048167248168361799804404544850480230856014599844093845110169552441907838097341449438463694104522660447586089058487500800000000000000000000000*pi^2 + 47433902014512352728253492836643591905874107770846881481668351018069049215405117988141053071140024253849460456234119588790163912110536392704000000000000000000000000000)*s^5 + (6652396251086177423292927172410918419970147770987493527773914972900548967009444365026079571026169213384376687512329578964960870211981886935538485151685148672000000000000000*pi^4 + 221665125813009623697700248402119967320973157191925342792015506948244537179327623222784003593987892447576518892517275331762068598019612701054213333518699724800000000000000000*pi^2 - 245047594605066620549705564431625134725757042374560495081315587826892390603599426830894893718424984722409666122112964349829084919956335978400972800000000000000000000000000000*pi + 2536034891933805982401495363939786532940690593017677759853084958798194079782607771864122719869277700846061062359329088739391286449657700807904074294886400000000000000000000000)*s^4 + (30623844392473382817484079620428940624850360416857223496124119789395588900404754115921385260213451557927909293278864678428681440191263371819177780261758753306574848000000000000*pi^4 + 1375404288221077424160272558346555449189508267686648393400878947453378804631441102921320169746150186786490622816778703696673576564667446718473052969357670580695859200000000000000*pi^2 - 1533119470142069134185246737628619178807871951683791864157960181637741020196955960063931204406410900832629100482791442205011468696046682697678874717716480000000000000000000000000*pi + 16469341721930730704560659742666265093907013845812811247614010230389367761437746032907578038188075999061081245167726839512600557112036688972864071734829242122240000000000000000000)*s^3 + (64084750552130172102567445447303137206587919170068938494670485117209145100606301152780888738772019184541716481292705045681132311679198115280826268141458413947060004776816148480000000*pi^6 + 2886719132192119243329149519611688266853675864796952943663691220997387484758173719994194205846120598294289206736723116561867322244125996087956284278064476240820506045005105725440000000*pi^4 - 14163750968172849548999245922171690028467136051759503944392542272221905346151041669715642120997530469999849240662673978350881570004184889426636166044642648367733342732288000000000000000*pi^3 + 30687488544850518647818212335397803679948155338070228690523858273532814796581027058440954994932182340370866478718015155895017956268664569338741311834389432578123114314880516096000000000*pi^2 - 47774063017324060863663336521334602982704271865466460224541376281823616866305913865509486357451487394781817840867042535511762370382609856821035174072445495974821888000000000000000000000*pi + 404465952269446002842614780011722421358870132427708954651846431613474079942876646373890267878521845368253563418134617374210930077453974239860490628733189291908959655952384000000000000000)*s^2 + (49589685484895281439294605364878011478985153344036987685957881288066817938995526549752676018755996436517839254033066490272017929477243829188284434467037191852296551123423492220911616000*pi^6 + 13057455337845441313017005803911331062117925803862520488567269936628449847055333338503641106026806387877659982444745641741266668409964351448060648681108446921920469142356646231103504384000*pi^4 - 44307152687105793100130625660207787241320097116282376183192216041099961437664576488584454754162216638969855331809405328033287988887314142460001536059145821696892399382746785382400000000000*pi^3 + 40068371081455090737201178757681347901521476966700085254813018188889076254987595970030941691919436730769830761220621774629924260244669334775092065820173992857522468615998964609161625600000*pi^2 - 93538393158843510924301481983874911585034724706340420425852665522465699961397861514804998652444196708453257302539776888649328857643704629860922429816691375654293709049036800000000000000000*pi + 1364166974700368047567755827610932738042327125778332200334366577977074557808847083242569193152999569655235004926942178245700257160472650936668274394676245297623858158499314375065600000000000)*s - 11188061547329388768029922106405801936457943963003594606565401087466409044686712619360478817925088869817534781858521318020562934907684145984591076415874788217661112030248737080795463680000000000000*pi - 4565304984686251128442394075723442345113175188662942414796939182412239464695523928301987072044130084147471137752488029571221860436083251647531077194436511513468923204762318741345689884398138163200*pi^2 + 3153559290316563000146978244266269414477846576642144060410803557693211344636858833130768664444904900588461310214147433344884515983407159972202593401130938575950262504521376994290453048197120000000*pi^3 + 212083987121978484918250081604241228773158124977335737684976507732705593172055683518714360533377121159166197623005083366417822873838864564907513246383968303833913626751818255684786392570949271552*pi^4 - 204666201490097659816758622681825066422642934556479159478742352193236763781345923227620685885238394717324322152866736715349674792187859264141110757199362140506528640203958328911759021178880000000*pi^5 + 18279003426359136169274051589194478808476673714940349754336999236003794568296545674497877489549795606184827705494162984585927247987106629803713052790148990965599852031176739711275572552026554368*pi^6 + 17574691936422012294264933090417674398443158718454979898183140369009019228789818189174950033020900764264440703890868593568615109655702801336959935549483609913251889424846530030081739115724800000000))
0 Comments
Accepted Answer
Paul
on 12 Jan 2023
Hi Aditya
Have you considered converting TF to an lti system object? Better yet, is there really a need to use symbolic math at all. Most of the time, the problem can be just as easily solved using the tools in the Control System Toolbox. Here, I convert TF to a zpk object. The poles and zero of the zpk object seem to be an accruate representaion of those computed from TF.
syms s
TF = (16071372659616720348971165081004999648428177131661336835975212808174464104804932302273170494400847127597471245991117983298776585372267605539421056970196558807040000000000000000000000000000000000000000*s^5 + (- 242040933688860740963017955938206167689205806810799895194579139633348633363148457292647724688859995874055843157769570116746395007464765077369064723508328499261136703586304000000000000000000000000000000000*pi - 273706690585303535838114923591098568716625861433319921324980916211195316270195058278787099255624989777205169329599000245812964809573508978520602295196999348734419030507520000000000000000000000000000000000)*s^4 + (- 46046386334592754449684641625611365662407190966846780488855579349463485023752196478854771034419613492485868378161112436946965087591825377218567679925220504672772135321600000000000000000000000000*pi^2 - 2919273489978646456137479461825674175321620045036048000713014419645180448788724137692719397970573615988302698306935824184053480212015839324787851318355433299251993892968396979856998400000000000000000000000000000*pi + 12751044145783038240412150546864936978018955670583565308941311126612494667602551074089317024684243784583102955500404231734398598739750898808939724733136830058777720567019271073300480000000000000000000000000000000)*s^3 + (- 6994982983608074543086416528837199779512693623275457008758579189057252761550517483051917891993733608164675893111609389809339103656576832022159148091981405116852246977330941201538392983324160163840000000000000000000*pi^3 + 1978684319950689554340962234378513245531044274917382515293320644863406191275447010694412635954833379769570453836701920501637342277085886238755386482050167300406688307694252327826874139662929100800000000000000000000*pi^2 - 72062282376436226538254790580472608226171912678264357886760014205950714590681985511614759872182678771846406869651561940402101441562215348971766433044728512786858306019635106696647881774858240000000000000000000000000*pi - 63106015898524940053166357750191813435699809160809415369933831787833872960140145010060301474749027445832722935819740275313656502606171956021649392950150281007507717504823036595879709297868800000000000000000000000000)*s^2 + (- 13422971159038478991586100715894355361392675292619777339190202229295673752296582178236474231994847771631490666896486668712932493339405061526791789522445466414479276603834135555240438909148200007908292820992000000000000000*pi^4 - 84360082246506355086284484588450011384062639871198681238833455812387587995017653071032638714778902653163010963412352113195511841635405434056644935137634548335877922191259986028241740628376790343995675901952000000000000000*pi^3 + 368523924980504399721415926535882739561782673508313853784860278306183557107923676636631906717821803317565442594883509961309147675832503094910326858540220462006973370989496268932981608777929390115454829199360000000000000000*pi^2 + 1935757834976279570379458894861459524881747462871668949259464010836568536815506705729860933086166855068820496055633140342621953706106250256745018113613714615601779209135221211580323071578987298816000000000000000000000*pi + 1307247592911054735089828707843772556841031898001520796649335234015271964985767163271544276037430592433227356727537041958108673330048120714424758236374272288138014674870222942958425218228007818693181440000000000000000000000)*s + 10703302095513206226442301041443451136175358974760555193390188635902501530715796911609956946099437259458420115525965773733756670752750041078903850686290039211611589965102630474530591106252884969438954137426329600000000000000000*pi - 2461275291567629909715031614813888050836132428440394466898831863214824302645954751068612295842596465348588073956342192382028879064942343712528872607757544148212459689618718675058696797282315108233186601334466412544000000000000*pi^2 - 1999123003772242822016337080237618503023289838672119576561319378083765901686508072530045661481949850642513372781187257955882783421878768616866225271757117496225517704043122533383170490154260797946010848959257798246400000000000*pi^3 + 312350901991332518581238727427651648648196607399667657205212460151948362142863492737379409753328776494964370266415099964634772360672982027006237933104420100519240260723753537634479894537748510028323802429180503654400000000000*pi^4 + 646785046625462900954530969184842632528894769379138627140960950998016182246814766764516391494124581829571324929541375309269542701534677872452151498044059402908638053962916203616963494175615275460254201020416000000000000000000)/(48984409560824263706010871398400*(2654979486630579215662965246751627247072347342565346333042114808333042275840861824791284204833429881529181941464469718131340414402075111865997314453125*s^8 + 32557120063445092725156027893871611579281408513080669022459917635047348005891739929272608963649486986924961242263060480000000000000000000000000000000000000*s^7 + (230186721490871204557690705599120979955984941972243682979626747979919737500840506038996164187287231790112597617206820822584543045222400000000000000000000000000000*pi^2 + 4971078497436533680082628755431673015705404850983483363418954261251914872400943568396157063787648535934322961718128928487965070458880000000000000000000000000000000)*s^6 + (1941175452197981089008569048167248168361799804404544850480230856014599844093845110169552441907838097341449438463694104522660447586089058487500800000000000000000000000*pi^2 + 47433902014512352728253492836643591905874107770846881481668351018069049215405117988141053071140024253849460456234119588790163912110536392704000000000000000000000000000)*s^5 + (6652396251086177423292927172410918419970147770987493527773914972900548967009444365026079571026169213384376687512329578964960870211981886935538485151685148672000000000000000*pi^4 + 221665125813009623697700248402119967320973157191925342792015506948244537179327623222784003593987892447576518892517275331762068598019612701054213333518699724800000000000000000*pi^2 - 245047594605066620549705564431625134725757042374560495081315587826892390603599426830894893718424984722409666122112964349829084919956335978400972800000000000000000000000000000*pi + 2536034891933805982401495363939786532940690593017677759853084958798194079782607771864122719869277700846061062359329088739391286449657700807904074294886400000000000000000000000)*s^4 + (30623844392473382817484079620428940624850360416857223496124119789395588900404754115921385260213451557927909293278864678428681440191263371819177780261758753306574848000000000000*pi^4 + 1375404288221077424160272558346555449189508267686648393400878947453378804631441102921320169746150186786490622816778703696673576564667446718473052969357670580695859200000000000000*pi^2 - 1533119470142069134185246737628619178807871951683791864157960181637741020196955960063931204406410900832629100482791442205011468696046682697678874717716480000000000000000000000000*pi + 16469341721930730704560659742666265093907013845812811247614010230389367761437746032907578038188075999061081245167726839512600557112036688972864071734829242122240000000000000000000)*s^3 + (64084750552130172102567445447303137206587919170068938494670485117209145100606301152780888738772019184541716481292705045681132311679198115280826268141458413947060004776816148480000000*pi^6 + 2886719132192119243329149519611688266853675864796952943663691220997387484758173719994194205846120598294289206736723116561867322244125996087956284278064476240820506045005105725440000000*pi^4 - 14163750968172849548999245922171690028467136051759503944392542272221905346151041669715642120997530469999849240662673978350881570004184889426636166044642648367733342732288000000000000000*pi^3 + 30687488544850518647818212335397803679948155338070228690523858273532814796581027058440954994932182340370866478718015155895017956268664569338741311834389432578123114314880516096000000000*pi^2 - 47774063017324060863663336521334602982704271865466460224541376281823616866305913865509486357451487394781817840867042535511762370382609856821035174072445495974821888000000000000000000000*pi + 404465952269446002842614780011722421358870132427708954651846431613474079942876646373890267878521845368253563418134617374210930077453974239860490628733189291908959655952384000000000000000)*s^2 + (49589685484895281439294605364878011478985153344036987685957881288066817938995526549752676018755996436517839254033066490272017929477243829188284434467037191852296551123423492220911616000*pi^6 + 13057455337845441313017005803911331062117925803862520488567269936628449847055333338503641106026806387877659982444745641741266668409964351448060648681108446921920469142356646231103504384000*pi^4 - 44307152687105793100130625660207787241320097116282376183192216041099961437664576488584454754162216638969855331809405328033287988887314142460001536059145821696892399382746785382400000000000*pi^3 + 40068371081455090737201178757681347901521476966700085254813018188889076254987595970030941691919436730769830761220621774629924260244669334775092065820173992857522468615998964609161625600000*pi^2 - 93538393158843510924301481983874911585034724706340420425852665522465699961397861514804998652444196708453257302539776888649328857643704629860922429816691375654293709049036800000000000000000*pi + 1364166974700368047567755827610932738042327125778332200334366577977074557808847083242569193152999569655235004926942178245700257160472650936668274394676245297623858158499314375065600000000000)*s - 11188061547329388768029922106405801936457943963003594606565401087466409044686712619360478817925088869817534781858521318020562934907684145984591076415874788217661112030248737080795463680000000000000*pi - 4565304984686251128442394075723442345113175188662942414796939182412239464695523928301987072044130084147471137752488029571221860436083251647531077194436511513468923204762318741345689884398138163200*pi^2 + 3153559290316563000146978244266269414477846576642144060410803557693211344636858833130768664444904900588461310214147433344884515983407159972202593401130938575950262504521376994290453048197120000000*pi^3 + 212083987121978484918250081604241228773158124977335737684976507732705593172055683518714360533377121159166197623005083366417822873838864564907513246383968303833913626751818255684786392570949271552*pi^4 - 204666201490097659816758622681825066422642934556479159478742352193236763781345923227620685885238394717324322152866736715349674792187859264141110757199362140506528640203958328911759021178880000000*pi^5 + 18279003426359136169274051589194478808476673714940349754336999236003794568296545674497877489549795606184827705494162984585927247987106629803713052790148990965599852031176739711275572552026554368*pi^6 + 17574691936422012294264933090417674398443158718454979898183140369009019228789818189174950033020900764264440703890868593568615109655702801336959935549483609913251889424846530030081739115724800000000))
[num,den] = numden(TF);
zeros = vpasolve(num)
poles = vpasolve(den)
h = zpk(tf(sym2poly(num),sym2poly(den)))
[z,p,k] = zpkdata(h);
format long e
z{:}
p{:}
k
3 Comments
Paul
on 13 Jan 2023
Edited: Paul
on 13 Jan 2023
You need to do some computations on TF in symbolic form? Well, I suppose you could write your own symbolic code to:
compute the poles and zeros of TF
decide which poles and zeros of TF are close enough to cancel each other
delete those poles and zeros and recombine what's left into a rational function
adjust the gain of the that result to match the orignal TF in whatever sense you think is important (dc gain, gain at specific frequency, etc.)
Having said all that, it doesn't really look like any poles and zeros are close enough to consider as cancellable, but I guess that's up to you. Are you sure you can't use TF as is?
Would you mind giving more insight into why you want to stay in the symbolic world?
Also, I just noticed that code in the Question specifies s to be real. Assuming we are both talking about the same meaning of "transfer function," s is complex.
syms s
TF = (16071372659616720348971165081004999648428177131661336835975212808174464104804932302273170494400847127597471245991117983298776585372267605539421056970196558807040000000000000000000000000000000000000000*s^5 + (- 242040933688860740963017955938206167689205806810799895194579139633348633363148457292647724688859995874055843157769570116746395007464765077369064723508328499261136703586304000000000000000000000000000000000*pi - 273706690585303535838114923591098568716625861433319921324980916211195316270195058278787099255624989777205169329599000245812964809573508978520602295196999348734419030507520000000000000000000000000000000000)*s^4 + (- 46046386334592754449684641625611365662407190966846780488855579349463485023752196478854771034419613492485868378161112436946965087591825377218567679925220504672772135321600000000000000000000000000*pi^2 - 2919273489978646456137479461825674175321620045036048000713014419645180448788724137692719397970573615988302698306935824184053480212015839324787851318355433299251993892968396979856998400000000000000000000000000000*pi + 12751044145783038240412150546864936978018955670583565308941311126612494667602551074089317024684243784583102955500404231734398598739750898808939724733136830058777720567019271073300480000000000000000000000000000000)*s^3 + (- 6994982983608074543086416528837199779512693623275457008758579189057252761550517483051917891993733608164675893111609389809339103656576832022159148091981405116852246977330941201538392983324160163840000000000000000000*pi^3 + 1978684319950689554340962234378513245531044274917382515293320644863406191275447010694412635954833379769570453836701920501637342277085886238755386482050167300406688307694252327826874139662929100800000000000000000000*pi^2 - 72062282376436226538254790580472608226171912678264357886760014205950714590681985511614759872182678771846406869651561940402101441562215348971766433044728512786858306019635106696647881774858240000000000000000000000000*pi - 63106015898524940053166357750191813435699809160809415369933831787833872960140145010060301474749027445832722935819740275313656502606171956021649392950150281007507717504823036595879709297868800000000000000000000000000)*s^2 + (- 13422971159038478991586100715894355361392675292619777339190202229295673752296582178236474231994847771631490666896486668712932493339405061526791789522445466414479276603834135555240438909148200007908292820992000000000000000*pi^4 - 84360082246506355086284484588450011384062639871198681238833455812387587995017653071032638714778902653163010963412352113195511841635405434056644935137634548335877922191259986028241740628376790343995675901952000000000000000*pi^3 + 368523924980504399721415926535882739561782673508313853784860278306183557107923676636631906717821803317565442594883509961309147675832503094910326858540220462006973370989496268932981608777929390115454829199360000000000000000*pi^2 + 1935757834976279570379458894861459524881747462871668949259464010836568536815506705729860933086166855068820496055633140342621953706106250256745018113613714615601779209135221211580323071578987298816000000000000000000000*pi + 1307247592911054735089828707843772556841031898001520796649335234015271964985767163271544276037430592433227356727537041958108673330048120714424758236374272288138014674870222942958425218228007818693181440000000000000000000000)*s + 10703302095513206226442301041443451136175358974760555193390188635902501530715796911609956946099437259458420115525965773733756670752750041078903850686290039211611589965102630474530591106252884969438954137426329600000000000000000*pi - 2461275291567629909715031614813888050836132428440394466898831863214824302645954751068612295842596465348588073956342192382028879064942343712528872607757544148212459689618718675058696797282315108233186601334466412544000000000000*pi^2 - 1999123003772242822016337080237618503023289838672119576561319378083765901686508072530045661481949850642513372781187257955882783421878768616866225271757117496225517704043122533383170490154260797946010848959257798246400000000000*pi^3 + 312350901991332518581238727427651648648196607399667657205212460151948362142863492737379409753328776494964370266415099964634772360672982027006237933104420100519240260723753537634479894537748510028323802429180503654400000000000*pi^4 + 646785046625462900954530969184842632528894769379138627140960950998016182246814766764516391494124581829571324929541375309269542701534677872452151498044059402908638053962916203616963494175615275460254201020416000000000000000000)/(48984409560824263706010871398400*(2654979486630579215662965246751627247072347342565346333042114808333042275840861824791284204833429881529181941464469718131340414402075111865997314453125*s^8 + 32557120063445092725156027893871611579281408513080669022459917635047348005891739929272608963649486986924961242263060480000000000000000000000000000000000000*s^7 + (230186721490871204557690705599120979955984941972243682979626747979919737500840506038996164187287231790112597617206820822584543045222400000000000000000000000000000*pi^2 + 4971078497436533680082628755431673015705404850983483363418954261251914872400943568396157063787648535934322961718128928487965070458880000000000000000000000000000000)*s^6 + (1941175452197981089008569048167248168361799804404544850480230856014599844093845110169552441907838097341449438463694104522660447586089058487500800000000000000000000000*pi^2 + 47433902014512352728253492836643591905874107770846881481668351018069049215405117988141053071140024253849460456234119588790163912110536392704000000000000000000000000000)*s^5 + (6652396251086177423292927172410918419970147770987493527773914972900548967009444365026079571026169213384376687512329578964960870211981886935538485151685148672000000000000000*pi^4 + 221665125813009623697700248402119967320973157191925342792015506948244537179327623222784003593987892447576518892517275331762068598019612701054213333518699724800000000000000000*pi^2 - 245047594605066620549705564431625134725757042374560495081315587826892390603599426830894893718424984722409666122112964349829084919956335978400972800000000000000000000000000000*pi + 2536034891933805982401495363939786532940690593017677759853084958798194079782607771864122719869277700846061062359329088739391286449657700807904074294886400000000000000000000000)*s^4 + (30623844392473382817484079620428940624850360416857223496124119789395588900404754115921385260213451557927909293278864678428681440191263371819177780261758753306574848000000000000*pi^4 + 1375404288221077424160272558346555449189508267686648393400878947453378804631441102921320169746150186786490622816778703696673576564667446718473052969357670580695859200000000000000*pi^2 - 1533119470142069134185246737628619178807871951683791864157960181637741020196955960063931204406410900832629100482791442205011468696046682697678874717716480000000000000000000000000*pi + 16469341721930730704560659742666265093907013845812811247614010230389367761437746032907578038188075999061081245167726839512600557112036688972864071734829242122240000000000000000000)*s^3 + (64084750552130172102567445447303137206587919170068938494670485117209145100606301152780888738772019184541716481292705045681132311679198115280826268141458413947060004776816148480000000*pi^6 + 2886719132192119243329149519611688266853675864796952943663691220997387484758173719994194205846120598294289206736723116561867322244125996087956284278064476240820506045005105725440000000*pi^4 - 14163750968172849548999245922171690028467136051759503944392542272221905346151041669715642120997530469999849240662673978350881570004184889426636166044642648367733342732288000000000000000*pi^3 + 30687488544850518647818212335397803679948155338070228690523858273532814796581027058440954994932182340370866478718015155895017956268664569338741311834389432578123114314880516096000000000*pi^2 - 47774063017324060863663336521334602982704271865466460224541376281823616866305913865509486357451487394781817840867042535511762370382609856821035174072445495974821888000000000000000000000*pi + 404465952269446002842614780011722421358870132427708954651846431613474079942876646373890267878521845368253563418134617374210930077453974239860490628733189291908959655952384000000000000000)*s^2 + (49589685484895281439294605364878011478985153344036987685957881288066817938995526549752676018755996436517839254033066490272017929477243829188284434467037191852296551123423492220911616000*pi^6 + 13057455337845441313017005803911331062117925803862520488567269936628449847055333338503641106026806387877659982444745641741266668409964351448060648681108446921920469142356646231103504384000*pi^4 - 44307152687105793100130625660207787241320097116282376183192216041099961437664576488584454754162216638969855331809405328033287988887314142460001536059145821696892399382746785382400000000000*pi^3 + 40068371081455090737201178757681347901521476966700085254813018188889076254987595970030941691919436730769830761220621774629924260244669334775092065820173992857522468615998964609161625600000*pi^2 - 93538393158843510924301481983874911585034724706340420425852665522465699961397861514804998652444196708453257302539776888649328857643704629860922429816691375654293709049036800000000000000000*pi + 1364166974700368047567755827610932738042327125778332200334366577977074557808847083242569193152999569655235004926942178245700257160472650936668274394676245297623858158499314375065600000000000)*s - 11188061547329388768029922106405801936457943963003594606565401087466409044686712619360478817925088869817534781858521318020562934907684145984591076415874788217661112030248737080795463680000000000000*pi - 4565304984686251128442394075723442345113175188662942414796939182412239464695523928301987072044130084147471137752488029571221860436083251647531077194436511513468923204762318741345689884398138163200*pi^2 + 3153559290316563000146978244266269414477846576642144060410803557693211344636858833130768664444904900588461310214147433344884515983407159972202593401130938575950262504521376994290453048197120000000*pi^3 + 212083987121978484918250081604241228773158124977335737684976507732705593172055683518714360533377121159166197623005083366417822873838864564907513246383968303833913626751818255684786392570949271552*pi^4 - 204666201490097659816758622681825066422642934556479159478742352193236763781345923227620685885238394717324322152866736715349674792187859264141110757199362140506528640203958328911759021178880000000*pi^5 + 18279003426359136169274051589194478808476673714940349754336999236003794568296545674497877489549795606184827705494162984585927247987106629803713052790148990965599852031176739711275572552026554368*pi^6 + 17574691936422012294264933090417674398443158718454979898183140369009019228789818189174950033020900764264440703890868593568615109655702801336959935549483609913251889424846530030081739115724800000000));
[num,den] = numden(TF);
h = zpk(tf(sym2poly(num),sym2poly(den)));
pzplot(h)
Walter Roberson
on 13 Jan 2023
Just in case there was precision problems in converting the large numbers:
syms s
TF = str2sym('(16071372659616720348971165081004999648428177131661336835975212808174464104804932302273170494400847127597471245991117983298776585372267605539421056970196558807040000000000000000000000000000000000000000*s^5 + (- 242040933688860740963017955938206167689205806810799895194579139633348633363148457292647724688859995874055843157769570116746395007464765077369064723508328499261136703586304000000000000000000000000000000000*pi - 273706690585303535838114923591098568716625861433319921324980916211195316270195058278787099255624989777205169329599000245812964809573508978520602295196999348734419030507520000000000000000000000000000000000)*s^4 + (- 46046386334592754449684641625611365662407190966846780488855579349463485023752196478854771034419613492485868378161112436946965087591825377218567679925220504672772135321600000000000000000000000000*pi^2 - 2919273489978646456137479461825674175321620045036048000713014419645180448788724137692719397970573615988302698306935824184053480212015839324787851318355433299251993892968396979856998400000000000000000000000000000*pi + 12751044145783038240412150546864936978018955670583565308941311126612494667602551074089317024684243784583102955500404231734398598739750898808939724733136830058777720567019271073300480000000000000000000000000000000)*s^3 + (- 6994982983608074543086416528837199779512693623275457008758579189057252761550517483051917891993733608164675893111609389809339103656576832022159148091981405116852246977330941201538392983324160163840000000000000000000*pi^3 + 1978684319950689554340962234378513245531044274917382515293320644863406191275447010694412635954833379769570453836701920501637342277085886238755386482050167300406688307694252327826874139662929100800000000000000000000*pi^2 - 72062282376436226538254790580472608226171912678264357886760014205950714590681985511614759872182678771846406869651561940402101441562215348971766433044728512786858306019635106696647881774858240000000000000000000000000*pi - 63106015898524940053166357750191813435699809160809415369933831787833872960140145010060301474749027445832722935819740275313656502606171956021649392950150281007507717504823036595879709297868800000000000000000000000000)*s^2 + (- 13422971159038478991586100715894355361392675292619777339190202229295673752296582178236474231994847771631490666896486668712932493339405061526791789522445466414479276603834135555240438909148200007908292820992000000000000000*pi^4 - 84360082246506355086284484588450011384062639871198681238833455812387587995017653071032638714778902653163010963412352113195511841635405434056644935137634548335877922191259986028241740628376790343995675901952000000000000000*pi^3 + 368523924980504399721415926535882739561782673508313853784860278306183557107923676636631906717821803317565442594883509961309147675832503094910326858540220462006973370989496268932981608777929390115454829199360000000000000000*pi^2 + 1935757834976279570379458894861459524881747462871668949259464010836568536815506705729860933086166855068820496055633140342621953706106250256745018113613714615601779209135221211580323071578987298816000000000000000000000*pi + 1307247592911054735089828707843772556841031898001520796649335234015271964985767163271544276037430592433227356727537041958108673330048120714424758236374272288138014674870222942958425218228007818693181440000000000000000000000)*s + 10703302095513206226442301041443451136175358974760555193390188635902501530715796911609956946099437259458420115525965773733756670752750041078903850686290039211611589965102630474530591106252884969438954137426329600000000000000000*pi - 2461275291567629909715031614813888050836132428440394466898831863214824302645954751068612295842596465348588073956342192382028879064942343712528872607757544148212459689618718675058696797282315108233186601334466412544000000000000*pi^2 - 1999123003772242822016337080237618503023289838672119576561319378083765901686508072530045661481949850642513372781187257955882783421878768616866225271757117496225517704043122533383170490154260797946010848959257798246400000000000*pi^3 + 312350901991332518581238727427651648648196607399667657205212460151948362142863492737379409753328776494964370266415099964634772360672982027006237933104420100519240260723753537634479894537748510028323802429180503654400000000000*pi^4 + 646785046625462900954530969184842632528894769379138627140960950998016182246814766764516391494124581829571324929541375309269542701534677872452151498044059402908638053962916203616963494175615275460254201020416000000000000000000)/(48984409560824263706010871398400*(2654979486630579215662965246751627247072347342565346333042114808333042275840861824791284204833429881529181941464469718131340414402075111865997314453125*s^8 + 32557120063445092725156027893871611579281408513080669022459917635047348005891739929272608963649486986924961242263060480000000000000000000000000000000000000*s^7 + (230186721490871204557690705599120979955984941972243682979626747979919737500840506038996164187287231790112597617206820822584543045222400000000000000000000000000000*pi^2 + 4971078497436533680082628755431673015705404850983483363418954261251914872400943568396157063787648535934322961718128928487965070458880000000000000000000000000000000)*s^6 + (1941175452197981089008569048167248168361799804404544850480230856014599844093845110169552441907838097341449438463694104522660447586089058487500800000000000000000000000*pi^2 + 47433902014512352728253492836643591905874107770846881481668351018069049215405117988141053071140024253849460456234119588790163912110536392704000000000000000000000000000)*s^5 + (6652396251086177423292927172410918419970147770987493527773914972900548967009444365026079571026169213384376687512329578964960870211981886935538485151685148672000000000000000*pi^4 + 221665125813009623697700248402119967320973157191925342792015506948244537179327623222784003593987892447576518892517275331762068598019612701054213333518699724800000000000000000*pi^2 - 245047594605066620549705564431625134725757042374560495081315587826892390603599426830894893718424984722409666122112964349829084919956335978400972800000000000000000000000000000*pi + 2536034891933805982401495363939786532940690593017677759853084958798194079782607771864122719869277700846061062359329088739391286449657700807904074294886400000000000000000000000)*s^4 + (30623844392473382817484079620428940624850360416857223496124119789395588900404754115921385260213451557927909293278864678428681440191263371819177780261758753306574848000000000000*pi^4 + 1375404288221077424160272558346555449189508267686648393400878947453378804631441102921320169746150186786490622816778703696673576564667446718473052969357670580695859200000000000000*pi^2 - 1533119470142069134185246737628619178807871951683791864157960181637741020196955960063931204406410900832629100482791442205011468696046682697678874717716480000000000000000000000000*pi + 16469341721930730704560659742666265093907013845812811247614010230389367761437746032907578038188075999061081245167726839512600557112036688972864071734829242122240000000000000000000)*s^3 + (64084750552130172102567445447303137206587919170068938494670485117209145100606301152780888738772019184541716481292705045681132311679198115280826268141458413947060004776816148480000000*pi^6 + 2886719132192119243329149519611688266853675864796952943663691220997387484758173719994194205846120598294289206736723116561867322244125996087956284278064476240820506045005105725440000000*pi^4 - 14163750968172849548999245922171690028467136051759503944392542272221905346151041669715642120997530469999849240662673978350881570004184889426636166044642648367733342732288000000000000000*pi^3 + 30687488544850518647818212335397803679948155338070228690523858273532814796581027058440954994932182340370866478718015155895017956268664569338741311834389432578123114314880516096000000000*pi^2 - 47774063017324060863663336521334602982704271865466460224541376281823616866305913865509486357451487394781817840867042535511762370382609856821035174072445495974821888000000000000000000000*pi + 404465952269446002842614780011722421358870132427708954651846431613474079942876646373890267878521845368253563418134617374210930077453974239860490628733189291908959655952384000000000000000)*s^2 + (49589685484895281439294605364878011478985153344036987685957881288066817938995526549752676018755996436517839254033066490272017929477243829188284434467037191852296551123423492220911616000*pi^6 + 13057455337845441313017005803911331062117925803862520488567269936628449847055333338503641106026806387877659982444745641741266668409964351448060648681108446921920469142356646231103504384000*pi^4 - 44307152687105793100130625660207787241320097116282376183192216041099961437664576488584454754162216638969855331809405328033287988887314142460001536059145821696892399382746785382400000000000*pi^3 + 40068371081455090737201178757681347901521476966700085254813018188889076254987595970030941691919436730769830761220621774629924260244669334775092065820173992857522468615998964609161625600000*pi^2 - 93538393158843510924301481983874911585034724706340420425852665522465699961397861514804998652444196708453257302539776888649328857643704629860922429816691375654293709049036800000000000000000*pi + 1364166974700368047567755827610932738042327125778332200334366577977074557808847083242569193152999569655235004926942178245700257160472650936668274394676245297623858158499314375065600000000000)*s - 11188061547329388768029922106405801936457943963003594606565401087466409044686712619360478817925088869817534781858521318020562934907684145984591076415874788217661112030248737080795463680000000000000*pi - 4565304984686251128442394075723442345113175188662942414796939182412239464695523928301987072044130084147471137752488029571221860436083251647531077194436511513468923204762318741345689884398138163200*pi^2 + 3153559290316563000146978244266269414477846576642144060410803557693211344636858833130768664444904900588461310214147433344884515983407159972202593401130938575950262504521376994290453048197120000000*pi^3 + 212083987121978484918250081604241228773158124977335737684976507732705593172055683518714360533377121159166197623005083366417822873838864564907513246383968303833913626751818255684786392570949271552*pi^4 - 204666201490097659816758622681825066422642934556479159478742352193236763781345923227620685885238394717324322152866736715349674792187859264141110757199362140506528640203958328911759021178880000000*pi^5 + 18279003426359136169274051589194478808476673714940349754336999236003794568296545674497877489549795606184827705494162984585927247987106629803713052790148990965599852031176739711275572552026554368*pi^6 + 17574691936422012294264933090417674398443158718454979898183140369009019228789818189174950033020900764264440703890868593568615109655702801336959935549483609913251889424846530030081739115724800000000))')
[num,den] = numden(TF);
h = zpk(tf(sym2poly(num),sym2poly(den)));
pzplot(h)
More Answers (1)
Walter Roberson
on 13 Jan 2023
syms x
TF = ((91*x^2)/50 - 2900*x + 5)/((743*x^2)/100 - (5011*x)/10 + 3)
NUMBER_OF_DIGITS = 10; %as appropriate
[N,D] = numden(TF);
D_coeffs = sym2poly(D);
lead_D = D_coeffs(1);
reduced_N = N/lead_D;
reduced_D = D/lead_D;
reduced_TF = vpa(reduced_N / reduced_D, NUMBER_OF_DIGITS)
reduced_TF is now in the canonical form that the leading coefficient of the denominator is 1
0 Comments
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!