Ian O'Neill asked . 2023-03-24

How to Get Intermediate Signal of Block Diagram for Control System?

Hi, I have a block diagram (included below) of a control system for a mass damped cart and a PID control system. I have set up the system and solved for the output (X position), but am now looking to solve for the actual voltage applied to the system and cannot figure out how to get that data from MATLAB.

Intermediate Signal of Block Diagram

Additionally here is my code that I currently have:
 
 
% Cart Transfer Function
s = tf('s');
G = 1.5531/(s^2+10.0938*s);
G.u = 'V'; %input (voltage)
G.y = 'X'; % ouput (x position)

% PID Controller Transfer Function
H = pid(120,10,40);
H.u = 'e'; % input (error)
H.y = 'V'; % output (voltage)

% Combined Transfer Function for R to X (X/R)
Sum = sumblk('e = R - X'); % solve for error in terms of R and X
XR = connect(H,G,Sum,'R','X');

% Solve for step response
[x1, t1] = step(XR,1.5);

My attempted solution was as follows:

% Combined Transfer Function for R to V (V/R)
VR = connect(H,G,Sum,'R','V');
% [V, t2] = step(VR,1.5); % Commented out because it throws error: 
% Error using DynamicSystem/step
% Cannot simulate the time response of improper (non-casual) models.
However this results in an improper model (More zeros than poles). I feel like there should be a function in MATLAB, but I have spent hours searching and nothing seems to fit what I am looking for.
 
Any help is greatly appreciated, and let me know if there is anything I forgot or anything I can clarify.

block diagram , transfer function , control system , pid

Expert Answer

Prashant Kumar answered . 2024-12-16 00:52:48

AFACIT, you did everything correctly as far as defining and connecting the diagram. With the PID controller defined, the transfer function from R to V is, in fact, improper (the numerator is higher order than the denominator).
 
Consider using the fourth argument to pid. Instead of a pure derivative, the 'derivative' term will be of the form Kd*s/(Tf*s + 1), i.e., a high pass filter. Normally, one would select Tf as large as it can be while still meeting system response requirements. Making Tf large reduces the high frequency gain H(s) and reduces high frequency effects on the control due to changes in R or noise on the feedback signal. Alternatively, you can try to make it small to better approximate the pure derivative if that's what you want. I modified the code below to make Tf = 1e-3 as an example. Also, we can specify both V and X as outputs from connect so we only need one code to get both responses.
 
 
 
s = tf('s');
G = 1.5531/(s^2+10.0938*s);
G.u = 'V'; %input (voltage)
G.y = 'X'; % ouput (x position)
% PID Controller Transfer Function
H = pid(120,10,40,1e-3)
H =
 
             1            s    
  Kp + Ki * --- + Kd * --------
             s          Tf*s+1 

  with Kp = 120, Ki = 10, Kd = 40, Tf = 0.001
 
Continuous-time PIDF controller in parallel form.
H.u = 'e'; % input (error)
H.y = 'V'; % output (voltage)
% Combined Transfer Function for R to X (X/R)
Sum = sumblk('e = R - X'); % solve for e,rror in terms of R and X
%XR = connect(H,G,Sum,'R','X');
% Solve for step response
%[x1, t1] = step(XR,1.5);
% Combined Transfer Function for R to V  and X 
clsys = connect(H,G,Sum,'R',{'V' 'X'});
zpk(clsys)
ans =
 
  From input "R" to output...
        40120 s (s+0.08579) (s+2.905) (s+10.09)
   V:  -----------------------------------------
       (s+0.08621) (s+2.584) (s+74.75) (s+932.7)
 
              62310 (s+2.905) (s+0.08579)
   X:  -----------------------------------------
       (s+0.08621) (s+2.584) (s+74.75) (s+932.7)
 
Continuous-time zero/pole/gain model.
% call step twice because the X repsonse takes longer than the V response
figure
step(clsys('X','R'))
Intermediate Signal of Block Diagram
 
 
 
 
 
figure
step(clsys('V','R'))

Intermediate Signal of Block Diagram


Not satisfied with the answer ?? ASK NOW

Frequently Asked Questions

MATLAB offers tools for real-time AI applications, including Simulink for modeling and simulation. It can be used for developing algorithms and control systems for autonomous vehicles, robots, and other real-time AI systems.

MATLAB Online™ provides access to MATLAB® from your web browser. With MATLAB Online, your files are stored on MATLAB Drive™ and are available wherever you go. MATLAB Drive Connector synchronizes your files between your computers and MATLAB Online, providing offline access and eliminating the need to manually upload or download files. You can also run your files from the convenience of your smartphone or tablet by connecting to MathWorks® Cloud through the MATLAB Mobile™ app.

Yes, MATLAB provides tools and frameworks for deep learning, including the Deep Learning Toolbox. You can use MATLAB for tasks like building and training neural networks, image classification, and natural language processing.

MATLAB and Python are both popular choices for AI development. MATLAB is known for its ease of use in mathematical computations and its extensive toolbox for AI and machine learning. Python, on the other hand, has a vast ecosystem of libraries like TensorFlow and PyTorch. The choice depends on your preferences and project requirements.

You can find support, discussion forums, and a community of MATLAB users on the MATLAB website, Matlansolutions forums, and other AI-related online communities. Remember that MATLAB's capabilities in AI and machine learning continue to evolve, so staying updated with the latest features and resources is essential for effective AI development using MATLAB.

Without any hesitation the answer to this question is NO. The service we offer is 100% legal, legitimate and won't make you a cheater. Read and discover exactly what an essay writing service is and how when used correctly, is a valuable teaching aid and no more akin to cheating than a tutor's 'model essay' or the many published essay guides available from your local book shop. You should use the work as a reference and should not hand over the exact copy of it.

Matlabsolutions.com provides guaranteed satisfaction with a commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been empanelled after extensive research and quality check.

Matlabsolutions.com provides undivided attention to each Matlab assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work done at the best price in industry.