MATLAB Matlab help with a design problem

  • Thread starter Thread starter Ethers0n
  • Start date Start date
  • Tags Tags
    Design Matlab
AI Thread Summary
The discussion revolves around a controller design problem in Matlab using the Polynomial Equations Approach. The user encounters a "Matrix is singular to working precision" error and receives NaN values from the last matrix M. The code defines various parameters for a servo position controller, constructs a plant transfer function, and attempts to invert the Sylvester Matrix E to determine controller coefficients. Key issues highlighted include the singularity of the matrix E, which is attributed to the variable a2 being set to zero, leading to an inability to compute the inverse. Suggestions include printing the matrix E to debug and considering the implications of having zeros in the matrix. There is also a discussion about potentially factoring out a term from the plant transfer function to resolve the issue, with an acknowledgment that this would require adjusting the poles accordingly.
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 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)
 
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?
 

Similar threads

Replies
2
Views
3K
Replies
1
Views
2K
Back
Top