Effacer les filtres
Effacer les filtres

How to get real and imaginary terms from an expression?

5 vues (au cours des 30 derniers jours)
Aditya Zade
Aditya Zade le 11 Déc 2022
Commenté : Aditya Zade le 12 Déc 2022
I am trying to get real and imaginary terms from the following expression TF. But real(), imag() is not able to give me any solution.
syms s real
ws = 2 * pi * 85000 ;
Lp = 27.13e-6 ;
Cpp = 129.23e-9 ;
Zp = s * Lp + ws * Lp * 1i ;
Zpp = 1 / ( s * Cpp + ws * Cpp * 1i ) ;
TF = Zpp * Zp / ( Zp + Zpp ) ;
These two commands give me following answers.
TFreal = real(TF)
TFreal = 
TFimag = imag(TF)
TFimag = 
You can observe that the answers have real, imag commands in them instead of answers.
  2 commentaires
Paul
Paul le 11 Déc 2022
Hi Aditya,
Normally, a transfer function, which I assume is what TF means, is defined as a function of s, which is a complex variable, and all other terms in the tansfer function are all real. But here, we have s defined as real, and other terms in the TF are complex. Can you clarify exactly what this code is intened for?
Aditya Zade
Aditya Zade le 11 Déc 2022
Hey Paul,
Only 's' is a variable which I have defined as a real number.

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 11 Déc 2022
syms s real
ws = 2 * pi * 85000 ;
Lp = 27.13e-6 ;
Cpp = 129.23e-9 ;
Zp = s * Lp + ws * Lp * 1i ;
Zpp = 1 / ( s * Cpp + ws * Cpp * 1i ) ;
TF = Zpp * Zp / ( Zp + Zpp ) ;
TFreal = real(TF)
TFreal = 
TFimag = imag(TF)
TFimag = 
simplify(TFreal)
ans = 
simplify(TFimag)
ans = 
  10 commentaires
Aditya Zade
Aditya Zade le 12 Déc 2022
Thanks for your help.
Aditya Zade
Aditya Zade le 12 Déc 2022
One of my transfer function is mentioned below. The problem is matlab is considering it as inf/inf which is giving me NaN in TF. How can I reduce the accuracy of each cofficients such that matlab doesn't consider numerator and denominator as inf.
In other words, how can I make this expression into a TF to generate bode plots.
H_mi_idenvecap = (3198609293274692543065653067624214930931010880602439324145398125122373719207088478979647504147912365379393279754941675512836511355487782993690473574523041631084160518721751172162257705176739868804951103644988270056301183639951764002961292649184871320805158132898539453590562021769463423670681600*s^10 + 528394964584010682783572570459412119664515594164049190345558269437867459470515176667326104615180103456012477355413596835172119921200079260151617877500088502992749340415451742149406277381474643891231659256544455164436234396533126019809440535921033867151082644616021673572586341975274322902549476147200*s^9 + 3364815264139209882761251038034730020362043044801573317888318745671317862412400497423209337541418420521260443952869134388981445799336993041335421299405549089717062472469931053659028441787475552139751801731258711488308627072509140489498330224609031510667147325022465839409185515146370263699813850219632656384*s^8 + 563685908110931596054975975789145169901513780980290358304128472564818439113945323667367115971977027594918152558869188644661828289297726904892093313231476094308350368709481298326017516778957422345680859263591644269304648598798995637702553858174358334141567592255906469564947805207135557231654360809390637347504128*s^7 + 1490257685171315468981773939159767624935105379546903549767553901546757666260988184536138242660525137524427599600907269172197568037353264870592893757184448550843993106896014192025989160859007053395078824566748256700430184559758347451096212214570755769067612673807213370221663874574993990956271545381513459363454956601344*s^6 + 224411121359031406238956529185520395250362431900419601379549724354175300141779807782002787175390937335420258029478904711464033857382032746518758309250170139544602989872581677894407504342046674752426946975585667274279454218538522463096065609371083080593692625877514805336214723108899068335933784036977289350835195383669325824*s^5 + 313435614540771365005472378788015656763925845027971206036651498864090340592352682307018010940557769472344445076584267523825439903337732769841322691195467198038852610063857978387582140881350878878314891681041745284058278276910429225911095101311401498430011153223268796705288141506966312381716632816295470628030364360123375283077120*s^4 + 33052372310506629010656599121147115620859961521559341305146351113127420214834631202990344435993579760702170846892190791973857746526095679537107762472443219962883772363971249591309331211286424393764376285694816602968673940014673553192267278248106274456921340775937053409889209132481984880619358508372583085903071902984276537872895442944*s^3 + 10554849876610050019218981278396688996628674897403163356241700611846899932472970866934831849299194775963827696479104585836123032305509546783003015154442878237125239205963612543055962962608195786274300100491480333594963695160464423230708118733213297370805489181822237410178521006221240286568706063689875376392244199192804233754948767114592256*s^2 + 753392467992893717086282360117150962316839153406675455633706582201238077981189206904259370759701924447550938546700321591834810653022526799241547416036382680758251634390626464710218582595943371303498239715517551074690452253677797215333441705005554261781839683641360100743141925156332627926700008050827621415436588867603559400388725106077190848512*s + 40393566359665865213299995369702801378786875218724874851168023401021269156066673958605743192955287230615526894469312967897474790091218367504457257709499999902912836650529949891815535967261169141147611466577851052777443496008708518428106932969186262475588373778567341855852815573620320080624013993765045842114972784171785710233396747569200139998330880)/(8796093022208*(1736567701589301145136648268745070267169586006463452702588095291310545287345936191207231693796554822487658048259058768341620886269302733511008839672446368759925297181964446329483562182298316297460367920025475136735375318177318220152446938927265225*s^16 + 717181706990849576639378846143604344747449411096706760755432781269930354932423747033964722181786892343713490722151365999943109079738204766382874076277599763531511760836188464560773573023546208271499106196789947712108879925411040105198246484299810406400*s^15 + 8474902337396137452537172814758191980658242868146989657851391747578894251875032832065877742822364594666025855664179609126663161480336968740345550831115764290784755921679756769231426450016836146980279285273763923555792818972379443730261637462558119995610497024*s^14 + 3060326629338539947795355844711670424230830104533914727180539407962588796854615013646350523884347125794176122078030819700072795725888050006338552712785006937280184063404052729170190527501487957786817505885405810768143497607256181752489430834429438245071731940130816*s^13 + 15335444336168058219053185629448334708949063277544031136997077132483020621337637079802757161722640630404872281753614633056555568331414532672223094357966529046772826765042453467781257350997846896530993396891805695459960227266764332535793736164051751621607630139917288341504*s^12 + 4711858733362574057644866067860734266890167073692817480732992906997138035715344442510025574475777812882693974120674123611995382178060815482516053616266140291523815161417712375969402534241363378219168042007415040048566795665071810311976396545823703304132119454866433941966946304*s^11 + 12461014205963250065638676548329519983986852678656821442028223071451986862953854290657145129348903622243955644402794979315564378889686689969794544728780606414037860400637500820387005456202310836355975107206149920656892865375979089113148380105538910212977991189672316595043017557016576*s^10 + 3153610764893990481124174423558310705947546643632994209428020901123162737494351255973870435414198228754915355165434369521635012685859083006757509655278714956660143488334593307926704075313537591188840386118802653628117669854992826061562111167065459384377864567395435560227329653331202146304*s^9 + 4196412284794922572702360089303675577340283804488759850189612200368294017368398595914096366806020918778693395129234114128153062192604212478313975760328409295684988085937308175782203157955672589220365686768906199996621051328446913656225084261462685321058494326091046314623083166983844470867361792*s^8 + 839696424033259323305277259210900820320478003816838709480281015945809199296634999150590387829225143482425327884290937963213529918958215499963010050257883261661116698672089983062272555691561771948624741135615136402177972155830430074599923524875698012649853320313826785826359259368579738843006040539136*s^7 + 341072015811716244581240425181942419448756068895024422843527961260011128604733215760197603405155010453702864279995268573154131226786824324708691134950163294295325223338672708909939254713696078247686589394867848835471068071716381633979836751951857567203826189555176612717339907046903740670679827717512232960*s^6 + 51476173533824520781908853124919012872558430328391461780218775183986801463554817939279579606358525500680300575053075911956606069305313326101015765941389705874779285216218534083105540702681692717458081833490789076288368074605827448462551175726017448688748586848426830311404300308080734687142200861235996885254144*s^5 + 9228963476387818526423807612115148970316248169275808385076365503267308598269819401998734036439982463217524876484624976388723299159343094174914050928582387570266303834881596621229787172099209884856109159135095077583516660315341853942084463079767357281710097403352648761070698296853785890788932711840594861082305101824*s^4 + 911043127300211915454447709952136661126629354017481583423569852460766841727455715209418097330189535279221498687673228467765980464696556517614401815146230080830691482821416104568196921957378920491489758562441974400120279545914620076777651283757517630045507906342397020857506949542233013765663031850658377453871364193648640*s^3 + 75868678050389397096199117807278223110751098365028855498075829798267143867014386665936900343279698677835660735344427396694303631098532043960596038629673009001621357014913910492452492780815641595686087435829590661675243076354379570729851910901126879665446131462508434640539917488307446180193941439583412905434367223985904549888*s^2 + 3174513831849780742601338555460290943793994469034596358746253922613510616605561379821305476696010693727089813475729119325248586731428000109372903713452154026995530738937814787974412887244775242394586804120936971001141865477711946150235680311292016446655479884972049090441497967508802274262026411582423828562014806418492161112670208*s + 85101763546936457815360949157574484179847571907787276421705398659175650996907399114220574701462894693638387449557772198429740759814194738572525547329802602231403046298633131911713278866661938182354784531853129097941253657184023638815783627856915654844607628228041193047656641242417683444772761706726371526915906514106247461005512671232))

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interpolation of 2-D Selections in 3-D Grids dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by