Matlab Homework Help

The below solution is based on the control of DC motor, system analysis and controller design using Matlab. The solution demonstrates the detailed approach followed by our experts while providing the Matlab homework  help. Students who are struggling with their Matlab homework should find this very useful and thus can seek guidance for Matlab homework help. The solution includes Sımulınk design of DC motor and feedback controller design. The solution is prepared by our qualified Matlab experts following the step-by-step approach explaining the complex concepts as well as the application using Matlab and Sımulınk.

DC Motor Control

DC machines are characterized by their flexibility. Because of various combinations of shunt, series, separately excited field windings, they can be designed to Matlab homework help display a wide variety of volt-ampere or speed- torque characteristics. DC motor types are chosen according to customers need. Motors have two part as rotor which is rotational part and stator that is stable part. Also, main working principle of DC motors depends Matlab homework solution on magnetic flux and reluctance. Because of shape of Matlab programming homework help rotor and stator, components try to reach minimum reluctance and applying magnetic flux set going the rotor and maintains its motion. Also, rotor can be made magnetic material or winding with dc current which provides magnetic flux to the element. Therefore stator has winding which is provide the system flux.  There are for type of motors as mentioned previously.

Shunt Excited DC Motors

The field winding connects between the machine terminals. In other words, the field and armature windings are connected in parallel.

Matlab homework help

Figure 1: Shunt Excited DC Motor

  1. Series Excited DC Motor

The field and armature windings are connected in series and field currents are equal.

Matlab homework solution

Figure 2: Series Excited DC Motor

Compound Excited DC Machine

This machine is a combination of shunt and series machines depending upon the positions of field windings the directions of fluxes, different Matlab homework help types of compound machines can be arranged like cumulative and subtractive.

Help with Matlab homework

Figure 3: Cumulatively Compound Excited DC Motor

Separately Excited DC Machines

clear all;
close all;
theta=[60 0.5 40 6 40000];
%% for part a
r=200;
[x1ss uss]=findsteadystate(r,theta);
%% part b
r=50;
[x1 uss]=findsteadystate(r,theta);
tmax=10;
SYS = 'my_dc_motor';
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 50 ' );
ylim([0 60]);
r=100;
[x1 uss]=findsteadystate(r,theta);
tmax=10;
SYS = 'my_dc_motor';
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 100 ' );
ylim([0 120]);

The machine which is designed here is this type of machine. The field and machine circuits from two independent circuits. The Help with Matlab homework field winding is separately excited. This type of machines armature voltage is constant and speed depends on field current.

Matlab coding homework help

Figure 4: Separately Excited DC Motor

MOTOR DESIGN

Motor should be design according to given parameter. This parameter is field current, armature current, velocity and constants. Motor maintain Matlab coding homework help reference input stability. In this design reference input is velocity.  But reference input is bounded by this formula

From this equation r< 298.1 so that maximum numerical derivative Matlab value of speed can be 298.  This motor has designed to work under this speed, the motor capability is not appropriate speed that beyond that.

Another important parameter of the motor is armature Matlab homework help current which is bounded to lower than some value which is given that equation (x1 is also equal armature current.)

In order to move first motion of the rotor, armature current should beyond 0.33 A.

In order to design motor,  should be known what refer to that. So, using following equations, it can be found.We have three equation of dc motors Matlab homework solution moreover state equations of designed motor is given.

State equations as follows,

%% part c
% rotor inertia changes to +%50
theta(4:5)=(2/3)* theta(4:5);
r=50;
[x1 uss]=findsteadystate(r,theta);
tmax=10;
SYS = 'my_dc_motor';
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 50 for +%50 Inertia ' );
ylim([0 60]);

In state equations,  represents to armature current,  is the speed and u is the field current.

Let’s look at    so that,

According to both equations,  values can be represented easily.

Looking at equation above,

And,So up to that point we have explained what θ1, θ2, θ3, θ4 and θrepresents in terms of real dc motor equations of equation 3,4 and 5. Now we will start make our circuit by Help with Matlab homework designing it on the Simulink.

Matlab homework help

Figure 5: Simulink Design of DC Motor

In figure 5 Simulink design of the DC Motor has been illustrated but it should need to be notice that system is open loop. System Matlab coding homework help input is uss (current source) which is found by a Matlab function to determine also the steady state value of the x1 is also computed by this function. The function takes the desired output (i.e. y which is speed) as a reference value and gives steady state u and x1 values.  After computing this uss value by the function in the workspace we gave it to the Simulink  in order to run the system. There are 4 gains and one Matlab homework solution constant which are represents θ1, θ2, θ3, θ4 and θ5. After designing the system we have moved on to make simulation to see whether system works accordingly.

We will explain the system for reference signal equals 200 rpm but also for 50, 100 and 150 the simulation result will also provided.

r=100;
[x1 uss]=findsteadystate(r,theta);
tmax=10;
SYS = 'my_dc_motor';
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 100  for +%50 Inertia ' );
ylim([0 120]);
r=150;
[x1 uss]=findsteadystate(r,theta);
tmax=10;
SYS = 'my_dc_motor';
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 150 for +%50 Inertia ' );
ylim([0 180]);
r=200;
[x1 uss]=findsteadystate(r,theta);
tmax=10;
SYS = 'my_dc_motor';
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 200 for +%50 Inertia ' );
ylim([0 240]);

First of all since we know that our reference speed is 200 we have used a function to find the uss which is current source of our motor. The Matlab homework help result for r equals to 200 is uss is 0.0517 and x1 is 0.5805. Now we put this uss value to our DC Motor and see whether our output reaches to 200 or not.

matlab homework solution

Figure 6: Simulation results for r=200

Figure 6 agrees with the theoretical results. As result of that we could easily conclude that our system works quite fine. Now we will illustrates the Matlab homework help results for different reference signals.

Matlab homework help

From figures 7, 8 and 9 we can understand that in our system the output reaches its steady state value by a exponential stable equilibrium.

After illustrating result of our DC Motor we will now examine the effect of the inertia on our system. The reason behind why system Help with Matlab homework reaches in equilibrium point in a exponential curve is mainly due to inertia. Because inertia of a motor mainly decreases dw/dt as it is mentioned in the equation 5. So ur result must show that as inertia increases time required for the motor to reach its equilibrium speed gets larger.

In order to change motor inertia we need to Matlab homework help change the gain of our system. Equation 9 and 10 shows how these constants changes by the system parameters and these equations points out that  θ1, θ2, and θ3, are unchanged, however   θ4 and θ5 need to be change accordingly. Therefore we apply these changes on our DC Motor and Matlab coding homework help see the result for just reference speed is 200 rpm.

matlab homework solution

Figure 10: Simulation results for r=200 and J=+%50

Help with Matlab homework

Figure 11: Simulation results for r=200 and J=-%50

By examining figures 6, 10 and 11 we can see that for inertia increased fifty percent the time required to reach in equilibrium point is 1.5 second. However the other case Matlab homework help as inertia decreased fifty percent the required time is 0.5 sec. As a consequence of these results we could conclude that larger inertia increases the time needed to reach to equilibrium point.

% rotor inertia changes to -%50
heta(4:5)=(2)* theta(4:5);
r=50;
[x1 uss]=findsteadystate(r,theta);
tmax=10;
SYS = 'my_dc_motor';
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 50 for -%50 Inertia ' );
ylim([0 60]);
r=100;
[x1 uss]=findsteadystate(r,theta);
tmax=10;
SYS = 'my_dc_motor';
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 100  for -%50 Inertia ' );
ylim([0 120]);
r=150;
[x1 uss]=findsteadystate(r,theta);
tmax=10;
SYS = 'my_dc_motor';
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 150 for -%50 Inertia ' );
ylim([0 180]);
r=200;
[x1 uss]=findsteadystate(r,theta);
tmax=10;
SYS = 'my_dc_motor';
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 200 for -%50 Inertia ' );
ylim([0 240]);

INTEGRAL STATE FEEDBACK CONTROLLER DESIGN

After designing our motor by open loop system we could easily state that our system is not controllable and any uncontrollable system is not useful in real. Because we sometime may need our design should work faster than it works Matlab homework help when it is in open loop. Another reason is that formulas may not give us correct result sometime. Assume that we want our system to work in a way that output speed is 200 rpm. Now in a frictionless environment with perfect estimation on the constants (θ1, θ2, θ3, θ4 and θ5) we could get 200 rpm as output. However is this trustable for all cases, i.e. are we sure always that there will be no friction Matlab homework help and estimation on the constants are correct. Of course one can easily say that this is not the case and some problems happens always there could be a problem that our output may be the case we desire. So in this situation control takes place which is by use of sensors and other measurement tools output of system is taken and input of the system changes according to error on the output and reference signal that we want to see in output.

Matlab coding homework help

Figure 12: Open loop system

Matlab homework help

Figure 13: Closed loop system

Figure 12 and 13 show the block diagrams for open loop and closed loop systems and there are several types of control system. When we want our Matlab homework help system to reach at steady state to a reference signal then we use error control systems and they can be classified in the following groups Proportional Control system image processing

Matlab homework solution

Figure 14: Proportional control system

We mainly subtract the reference signal from output and this gives us error, after taking error we multiply it by a KP value which gives us a new signal and this signal Matlab coding homework help is the new input of the H(s) as in Figure 14. As the output reaches to steady state error gets decrease and system starts to maintain it.

There are several advantages and disadvantages of proportional control system. One advantage is that it is easy to implement.  However it could be unstable if the proportionality constants gets too high and which is not desired. Also lower KP leads to not fast response. As a result of this although we could reach our desired Matlab homework help output proportional control system has several disadvantages and we need some more systems to compensate it.

Integral Control system

DC motor control

Figure 15: Integral control system

Unlike proportional control system in integral control system we take the integral of the error and multiply it with a proportional constant Matlab homework helpand this gives us input of a open loop system. Since we get integral of the error for a later system goes under steady state that error becomes zero and this leads to constant input for open loop system. For controlling our DC Motor we also have used this method.

There are several advantages of integral control system. First of all it reduces the rise time although it increases the settling time. As integral gain gets larger the input of the system which is u(t) in our case gets more higher than Matlab homework solution it should be in steady state and this leads to a very high increase on the speed. However as we mentioned as the integral constant gets too high this leads to a higher settling time. Second important advantages is we could change poles locations as we desire and this is the case how we achieve faster response.

%% part d
theta=[60 0.5 40 6 40000];      % again we use same theta
tmax=10;
r=50;
P = [-20+2*i;-20-2*i;-20];      % poles' location
Kplace=findingKi(r,theta,P);
SYS='feedback_controller';
sim(SYS);
% for part a
r=200;
[x1ss uss]=findsteadystate(r,theta);
% part d-b
r=50;
[x1 uss]=findsteadystate(r,theta);
tmax=3;
Kplace=findingKi(r,theta,P);
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 50 with controller ' );
ylim([0 100]);

Derivative Control System

Matlab homework help

Figure 16: Derivative control system

In derivative control system we take the derivative of the error and after multiplying with derivative gain we get our open system’s input as u(t). As system reaches steady state the error becomes zero and this leads to our output to be in equilibrium point.

This control system cannot be used alone it should be used at least with other control types such as PID (Proportionality Integral derivative Matlab homework help control system). The reason behind it is it never improves the error and also the saturation effects that it produces.

After explaining little bit information about control theory now we could see the result of our simulation for integral control system. First of all Help with Matlab homework in this new design we have a new input which is reference signal in Simulink environment

Matlab homework solution

Figure 17: Integral Controller Diagram on Simulink

In figure 17 we have showed the integral controller system in Simulink. The difference between this and figure 5 is just the controller part. You can see that the reference speed is subtracted from output speed and integrated and by using Matlab homework help Gain1 it is multiplied by proportionality constant Ki.

r=100;
[x1 uss]=findsteadystate(r,theta);
tmax=3;
Kplace=findingKi(r,theta,P);
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 100 with controller ' );
ylim([0 160]);
r=150;
[x1 uss]=findsteadystate(r,theta);
tmax=3;
Kplace=findingKi(r,theta,P);
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 150 with controller ' );
ylim([0 240]);
r=200;
[x1 uss]=findsteadystate(r,theta);
tmax=3;
Kplace=findingKi(r,theta,P);
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 200 with controller ' );
ylim([0 300]);
% part d-c
% rotor inertia changes to +%50
theta(4:5)=(2/3)* theta(4:5);
r=50;
[x1 uss]=findsteadystate(r,theta);
tmax=3;
Kplace=findingKi(r,theta,P);
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 50 for +%50 Inertia with controller ' );
ylim([0 100]);
r=100;
[x1 uss]=findsteadystate(r,theta);
tmax=3;
Kplace=findingKi(r,theta,P);
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 100  for +%50 Inertia with controller ' );
ylim([0 160]);
r=150;
[x1 uss]=findsteadystate(r,theta);
tmax=3;
Kplace=findingKi(r,theta,P);
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 150 for +%50 Inertia with controller ' );
ylim([0 240]);
r=200;
[x1 uss]=findsteadystate(r,theta);
tmax=3;
Kplace=findingKi(r,theta,P);
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 200 for +%50 Inertia with controller ' );
ylim([0 300]);

We have implement a Matlab script that computes the required Kİ for desired poles locations. So by using this script  we can change our speed regulation and rising time as we want. After designing the system in Matlab and Simulink environment we have simulate our controller.

Matlab coding homework help

Figure 18: Plot of u(t) and y(t) for r=200 with poles at P = [-20+2*j, -20-2*j,-20]

Help with Matlab homework

Figure 19: Plot of u(t) and y(t) for r=200 with poles at P = [-10+2*j,-10-2*j,-10]

Figure 18 and 19 are simulated for different poles locations. Before explaining the effects of poles we want focus on that how our design gets results successfully. Figure 18 illustrates that since there is now integral control on our system y is not in exponential equilibrium anymore. It has under damped equilibrium. And we can also see Image processing that the rising time has increased compared to Figure 5. Also Figure illustrates when closed loop poles are located at P = [-20+2*j, -20-2*j,-20] and since the poles are far from imaginary axis the rising is higher that of Figure 19 where poles are locate at P = [-10+2*j,-10-2*j,-10].

Matlab homework help

Figure 20: Plot of u(t) and y(t) for r=50

DC motor control

Figure 21: Plot of u(t) and y(t) for r=100

% rotor inertia changes to -%50
theta(4:5)=(2)* theta(4:5);
r=50;
[x1 uss]=findsteadystate(r,theta);
Kplace=findingKi(r,theta,P);
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 50 for -%50 Inertia with controller ' );
ylim([0 100]);
r=100;
[x1 uss]=findsteadystate(r,theta);
tmax=10;
Kplace=findingKi(r,theta,P);
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 100  for -%50 Inertia with controller ' );
ylim([0 160]);
r=150;
[x1 uss]=findsteadystate(r,theta);
tmax=10;
Kplace=findingKi(r,theta,P);
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 150 for -%50 Inertia with controller ' );
ylim([0 240]);
r=200;
[x1 uss]=findsteadystate(r,theta);
tmax=3;
Kplace=findingKi(r,theta,P);
plot_u_and_y( r, theta , SYS );
title('   plot of u and y for r = 200 for -%50 Inertia with controller ' );
ylim([0 300]);

Matlab homework solution

Figure 22: Plot of u(t) and y(t) for r=150

Matlab coding homework help

Figure 23: Plot of u(t) and y(t) for r=200 and J=+%50

Matlab homework help

Figure 24: Plot of u(t) and y(t) for r=200 and J=-%50

Figure 20 21 and 22 shows the simulation result for different reference speed and they are as expected. Also figure 23 and 24 are for different inertia and we can say that in order to have same rise time condition (i.e. same poles and zeros) the required Ki values are different. Because inertia effects the open loop poles locations. So in order to compensate it we need to lose from other important parameters as trade off . In this case settling time decreases for the case of less inertia system.

Save