Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please provide the MatLab Code with thier respected images. Add comments to the

ID: 2249832 • Letter: P

Question

Please provide the MatLab Code with thier respected images.
Add comments to the code so i know what is going on.
Explain each step when solving the problem, so i can follow allong and understand.
Thank You.

a. Consider proportional control of the plant G(s) tion), and answer the following questions using the appropriate root locus i) What is the smallest achievable settling time? ii) What is the smallest achievable rise time? iii) If we wish to limit the overshoot to 10%, what are the smallest achievable settling time and rise time? What gain achieves this rise time and settling time? (For finding the gain, please think about how you can do this by hand, in aidition to sing Matlab.) iv) If we wish to limit the steady-state error due to a unit step reference to 596, what is the smallest achievable overshoot? = Te 6 +T T (in the unity-gain-feedback configura- b. Consider PD control of this plant, using the controller D(s) K(s + 10), where K 2 0 is a gain parameter. Answer the following questions (by drawing the appropriate root locus in Matlab): i) What is the smallest achievable settling time? ii) What is smallest achievable rise time? iii) If we wish to limit the overshoot to 10%, what are the smallest achievable settling time and rise time? iv) If we wish to limit the steady-state error due to a unit step reference to 5%, what is the smallest achievable overshoot? c. Consider PD control of this p.ant, using the controller D(s) -kp + kds. Find kp and kd so that s =--2 4, is on the root locus K(s+10 +100 re K 20 is a gain parameter. d. Consider control of this piant using the controller D(s (This controller is a lead compensator; it is a good approximation for a PD controller, but doesn't suffer from the noise issues that are typical of PD controllers.) If we wish to limit the overshoot to 10%, what are the smallest achievable settling time and rise time?

Explanation / Answer

%%%%%%%%%%%%%%%%%%%%%%%
% Build and define a MATLAB based PD controller using simple routines %
% Might be useful in cases of Hardware-In-Loop (HIL) applications %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc;clear;close all
tic % start timer to calculate CPU time

desired = 1; % desired output, or reference point
feed1 = 1; % can be replaced with damping coefficient B or (B/Mass)
feed2 = 1; % can be replaced with spring coefficient K or (K/Mass)
B = feed1;K = feed2;
Kp = 1; % proportional term Kp
Ki = 0.01; % Integral term Ki
Kd = 0.01; % derivative term Kd
dt = 0.01; % sampling time
Time = 10; % total simulation time in seconds
n = round(Time/dt); % number of samples

% pre-assign all the arrays to optimize simulation time
Prop(1:n+1) = 0; Der(1:n+1) = 0; Int(1:n+1) = 0; I(1:n+1) = 0;
PID(1:n+1) = 0;
FeedBack(1:n+1) = 0;
Output(1:n+1) = 0;
Error(1:n+1) = 0;
state1(1:n+1) = 0; STATE1(1:n+1) = 0;
state2(1:n+1) = 0; STATE2(1:n+1) = 0;

for i = 1:n
Error(i+1) = desired - FeedBack(i); % error entering the PID controller
  
Prop(i+1) = Error(i+1);% error of proportional term
Der(i+1) = (Error(i+1) - Error(i))/dt; % derivative of the error
Int(i+1) = (Error(i+1) + Error(i))*dt/2; % integration of the error
I(i+1) = sum(Int); % the sum of the integration of the error
  
PID(i+1) = Kp*Prop(i) + Ki*I(i+1)+ Kd*Der(i); % the three PID terms
  
%% You can replace the follwoing five lines with your system/hardware/model
STATE1(i+1) = sum(PID); % sum PID term to calculate the first integration
state2(i+1) = (STATE1(i+1) + STATE1(i))*dt/2; % output after the first integrator
STATE2(i+1) = sum(state2); % sum output of first integrator to calculate the second integration
Output(i+1) = (STATE2(i+1) + STATE2(i))*dt/2; % output of the system after the second integrator
FeedBack(i+1) = state2(i+1)*feed1 + Output(i+1)*feed2;
end

tsim = toc % simulation time

% plot results
T = 0:dt:Time;
Reference = desired*ones(1,i+1);
plot(T,Reference,'r',T,Output,'b')
xlabel('Time (sec)')
legend('Desired','Simulated')

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote