Domanda

I have a lab assignment for a 2nd level circuit analysis class and the lab assignment is written with the intention that the student is using MATLAB. I can do everything in the assignment except using a printing function. I have been looking around and cannot find an OCTAVE equivalent.

The MATLAB code is:

r=[-6 -4 3];
p=[-3 -2 -1];
k=2;
[num,den]=residue(r,p,k)

num =

     2     5     3     6

den =

     1     6    11     6

I can do this much easily however how it is printed out is what I can not find an OCTAVE equivalent by, specifically the printsys() function and how it is used:

[num,den]=residue(r,p,k);
printsys(num,den,'s')


num/den = 

   2 s^3 + 5 s^2 + 3 s + 6
   -----------------------
    s^3 + 6 s^2 + 11 s + 6

Any ideas are appreciated

Thanks

È stato utile?

Soluzione

>> pkg load control % if you haven't got the control package already loaded
>> sys = tf(num,den)

Transfer function 'sys' from input 'u1' to output ...

      2 s^3 + 5 s^2 + 3 s + 6
 y1:  -----------------------
      s^3 + 6 s^2 + 11 s + 6

Continuous-time model.

The same works also in MATLAB if you have the Control System Toolbox.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top