Matlab help with a design problem

In summary, the problem is that Matlab is balking at taking the inverse function of the E matrix, which is preventing the controller from working. The code is as follows: %Servo Position Controller%Using Polynomial Equation Method%Defining the vairables in the TF%PlantTF = tf(PlantNum, PlantDenom);%building the plant transfer function%D = F*H, D = (s^3) + (2s^2) + s + 0 = (d0*s^3)+(d1*s^2)+(d2*s)+d3%D = [d3]
  • #1
Ethers0n
27
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
  • #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.
 
  • #3
So is that because there are zeros in the E matrix?
 
  • #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.
 
  • #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?
 

Related to Matlab help with a design problem

1. What is Matlab and how can it help with a design problem?

Matlab is a computational software program used by scientists and engineers to analyze data and develop mathematical models. It can be used to design and simulate complex systems, making it a valuable tool for tackling design problems.

2. Can Matlab help with different types of design problems?

Yes, Matlab has a wide range of functionalities that can be applied to various design problems, including signal processing, control systems, and image processing. It also has specialized toolboxes for specific industries, such as aerospace, automotive, and robotics.

3. Is Matlab easy to use for non-programmers?

While Matlab does require some basic programming knowledge, it has a user-friendly interface and a vast library of built-in functions that make it accessible for non-programmers. Additionally, there are many online resources and tutorials available for beginners.

4. Can Matlab help with optimization and design optimization problems?

Yes, one of the key features of Matlab is its ability to solve optimization problems. It has built-in optimization algorithms and tools that can be used to find the best design solutions for complex systems.

5. Can Matlab provide assistance with visualizing and analyzing data for a design problem?

Absolutely, Matlab has powerful visualization and data analysis tools that can help users understand and interpret complex data related to a design problem. It also has the ability to create 2D and 3D visualizations to aid in the design process.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
Back
Top