Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Please note this is an edit to the same question posed a few weeks back:

I'm using Mathematica to derive the transfer functions for a three phase AC/DC inverter.

Given below is the code for the derivation of the transfer function for a third order filter (LCL) connected system:

Clear[Asys, Bsys, Csys, Dsys]

numericalvalues = {
R1 -> 0.,
R2 -> 0.,
Rd -> 0.,
Lff ->  2.3*10^-3,
Lgf -> 0.93*10^-3,
Cf -> 10*10^-6,
Vbatt ->  400,
Vdc -> 800,
d -> 1};

Asys = {{(Rd - R1)/Lff, -(Rd/Lff), 1/Lff}, {-(Rd/Lgf), (R2 + Rd)/Lgf, 
1/Lgf}, {1/Cf, -(1/Cf), 0}};

Bsys = {{d/Lff}, {0}, {0}};
Csys = {{0, 1, 0}};

systf4 = TransferFunctionModel[Csys .Inverse[(( {
    {s, 0, 0},
    {0, s, 0},
    {0, 0, s}
   } ) - Asys)].Bsys, s]

Convertertf4 = Simplify[systf4 /. numericalvalues // N]

This results in the following transfer function:

(4.67508*10^10/(s^3+6.40486*10^7 s))

The transfer function calculated by this code differs from the same system solved in Matlab given below:

 4.675*10^10/ (s^3 + 1.527*10^-12 s^2 + 6.405*10^7 s + 9.78*10^-5)

Does Mathematica have a tolerance limit that it is assuming the small numbers are insignificant and can be ignored? Has anyone had any experience with this before?

share|improve this question
1  
I think you'll need to provide more information so that we can reproduce the problem. If you can find a small order example (for instance, does it happen with a 2 by 2 system?) then it will help. –  bill s Apr 2 '13 at 9:21
    
sorry should try to be more specific! I've added the code, it's a complicated problem but I imagine its a simple solution. –  dhog Apr 2 '13 at 10:11
    
I'll ask again: can you reproduce the problem in a more concise setting? Say with a single input single output transfer function? With a 2 by 2 system? –  bill s Apr 2 '13 at 10:56
    
No I can't seem to replicate the same problem with a simpler system. Matlab and Mathematica give the same answers when I compare a lower order system, but the lower order system is not related to what I'm trying to model here. –  dhog Apr 2 '13 at 11:08
1  
I notice you have a term in i1d/dd that is order 10^25. What is the dynamic range of Matlab's variables? There's a good chance that you have exceeded what Matlab can handle with numbers of this size. So I would try a SISO model with parameters of this size and see if you can find the discrepancy there. –  bill s Apr 2 '13 at 11:28

1 Answer 1

Might try without approximate values. To do this, instead use

numericValues = {Vphrms -> 230, 
   Vlinerms -> Sqrt[3] 230, \[Omega] -> 2 \[Pi] 50, L1 -> 23*10^-4, 
   L2 -> 93*10^-5, Cf -> 10*10^-6, Co -> 600*10^-6, rd -> 3/10, 
   r1 -> 1/5, r2 -> 1/5, Dd -> 623324/1000000, Dq -> 246624/10000000, 
   Vdc -> 650, I1d -> 16043/1000, I1q -> 0};

At this point I can do

Convertertf = TransferFunctionModel[nss, s];

Here is a part of the numeric approximation.

ExpandAll[N[Convertertf, 100]][[1, 1, 1]] // N

(* Out[165]= {-6.2539325944*10^36 + 1.93055879416*10^35 s + 
  1.9678706615*10^33 s^2 + 2.11669599008*10^28 s^3 + 
  3.14177464077*10^25 s^4 + 1.53589504062*10^20 s^5 + 
  1.21221140625*10^17 s^6, -1.55842541392*10^37 + 
  6.17150836132*10^35 s + 4.47220373219*10^30 s^2 + 
  6.55274146604*10^27 s^3 + 3.95988310348*10^22 s^4 + 
  3.80827444847*10^19 s^5, -9.64607534149*10^32 - 
  3.74550092088*10^32 s - 3.02482605383*10^30 s^2 - 
  2.42295265152*10^25 s^3 - 2.0098546875*10^22 s^4 - 
  6.0159375*10^16 s^5, 
 2.39971808234*10^34 - 9.50624299627*10^32 s - 
  9.29312987358*10^27 s^2 - 1.89132246052*10^25 s^3 - 
  3.77992501089*10^19 s^4, 
 4.28257698623*10^35 + 3.14637598178*10^33 s + 
  3.55325872599*10^28 s^2 + 5.02229243353*10^25 s^3 + 
  2.52853001177*10^20 s^4 + 1.93743708356*10^17 s^5} *)

Notice the coefficients vary in range by around 19 orders of magnitude. A computation at machine precision is not likely to handle such a scale difference very well.

share|improve this answer
    
I understand the range of values is quite large but if I try and solve using the state space to transfer function equation from state space theory I am given answers that correspond to Matlab. I've added this code to the above question. I really appreciate the input. –  dhog Apr 8 '13 at 9:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.