Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab help with a design problem

  1. Apr 27, 2005 #1
    I'm attempting to use Matlab to help me solve a controller design problem...
    I'm using the Polynomial Equations Approach for this design, but I'm getting an error, and a result I wasn't looking for.

    I'm getting an error that reads "Warning: Matrix is singular to working precision."

    Also, the last Matrix M is returning the values NaN for all values...

    My code is bellow. Any help would be appreciated

    %Servo Position Controller
    %Using Polynomial Equation Method

    %Defining the vairables in the TF

    Rm = 2.6; %armature resistance
    Km = 0.00767; %Back-emf constant
    Kt = 0.00767; %motor torque constant
    Jm = 3.87*exp(-7); %motor moment of inertia
    Jeq = 2.0*exp(-3); %equivalent moment of inertia at the laod
    Beq = 4.0*exp(-3); %equivalent viscous damping coefficent
    Kg = 70; %srv02 system gear ratio (motor->load) (14X5)
    Ng = 0.9; %gearbox efficiency
    Nm = 0.69; %motor efficiency

    a0 = Jeq*Rm %defining the terms of plant denominator
    a1 = (Beq*Rm + Ng*Nm*Km*Kt*(Kg)^2)
    a2 = 0;

    b0 = Ng*Nm*Kt*Kg %defining terms of plant Numerator

    PlantNum = [b0] %plant numerator
    PlantDenom = [a0 a1 a2] %plant denominator

    PlantTF = tf(PlantNum, PlantDenom); %building the plant transfer function

    %becuase a second order system is desired (from the lab handout)
    %the closed loop poles will be at s^2 + 2s + 1 ie at +-45 degrees from the

    E = [a2, 0, 0, 0; %the Sylvester Matrix E for a plant with the equation
    a1, a2, 0, 0; %like this (0*s^2) + (0*s) + X
    1, a1, b0, 0; % ---------------------
    0, 1, 0, b0;] % (z*s^2) + (y*s) + w

    % D = F*H, D = (s^3) + (2s^2) + s + 0 = (d0*s^3)+(d1*s^2)+(d2*s)+d3
    % D = [d3
    % d2
    % d1
    % d0]

    D = [0;

    M = (inv(E))*D %inverting the Sylvester Matrix and multiplying by D
    %this gives the coefficients which will produce the desired
    % M = [alpha1
    % alpha0
    % beta1
    % beta0]
    %The dseired controller is of the form
    % beta0 + beta1 Beta(z)
    % --------------- = --------
    % alpha0 + alpha1 Alpha(z)
  2. jcsd
  3. Apr 27, 2005 #2
    MATLAB is balking at taking the inverse function of E. Your elements of E don't work. NaN means Not A Number and that is showing up because the inverse of your E matrix is infinity thus a matrix times infinity yields NaN.
  4. Apr 27, 2005 #3
    So is that because there are zeros in the E matrix?
  5. Apr 27, 2005 #4
    do a print statement of the matrix E to find out...can't remember how in matlab...i think its just
    inv(E) %no semi-colon

    make sure you always print values to see if they work

    also take the inverse by hand ...i think your value of a2 = 0 is causing the INF.
  6. Apr 27, 2005 #5
    I think you're right.
    However, in order for a2 not to equal 0, the denominator of the equation would have to be different. ie, different plant.

    But, do you think i could get away with factoring out 1/s from the plant transfer function, doing the calculation, and then in the transfer function for the entire transfer function, add it back in?
    I'd have to adjust the poles, i realize...but...would it work?
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook