- #1

- 27

- 0

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

%axis...

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;

1;

2;

1;]

M = (inv(E))*D %inverting the Sylvester Matrix and multiplying by D

%this gives the coefficients which will produce the desired

%controller...

% M = [alpha1

% alpha0

% beta1

% beta0]

%The dseired controller is of the form

% beta0 + beta1 Beta(z)

% --------------- = --------

% alpha0 + alpha1 Alpha(z)