Matlab singular matrix error in polynomial equation controller design

  • Context: MATLAB 
  • Thread starter Thread starter Ethers0n
  • Start date Start date
  • Tags Tags
    Design Matlab
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
4 replies · 3K views
Ethers0n
Messages
27
Reaction score
0
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 coefficient
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

%because 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)
 
Physics news on Phys.org
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.
 
So is that because there are zeros in the E matrix?
 
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.
 
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?