Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask MATLAB Expert

Electrical Engineering Technology Lab Assignment

1. Objective

What is the purpose of the experiment?

2. Procedure

Write an explanation of the theory or procedure behind the exercise. Do not re-list the procedure as given in the laboratory manual or give a step-by-step account of the steps you took.

3. Data & Results

Give the experimental data in tabular or graphical form. Show samples of calculations. If applicable, include relevant MATLAB results such as graphs of output and command screen history. These can be attached as an appendix if needed.

4. Discussion

Discuss the results or your exercise and show how the objectives were met. Comment on how the results correlate with theoretical values. What are some causes of error in the results?

5. Conclusion

Briefly reiterate the key points of the above sections. Was the experiment considered a success? What (if anything) could have been done differently or better? What are some lessons learned?

6. Questions

Answer any questions that were asked in the exercise.

Laboratory Exercise 5

Inverted Pendulum: Simulink Modeling

Contents

• Physical setup and system equations
• Building the nonlinear model with Simulink
• Generating the open-loop response
• Extracting a linear model from the simulation

In this page we outline how to build a model of our inverted pendulum system for the purposes of simulation using Simulink and its add-ons. A great advantage of simulation, as will be demonstrated in this example, is that it can generate numerical solutions to nonlinear equations for which closed-form solutions cannot be generated. The nonlinear simulation can then be employed to test the validity of a linearized version of the model. The simulation model can also be used to evaluate the performance of the control scheme designed based on the linearized model.

Building the nonlinear model with Simulink

We can build the inverted pendulum model in Simulink employing the equations derived above by following the steps given below.

• Begin by typing simulink into the MATLAB command window to open the Simulink environment. Then open a new model window in Simulink by choosing New > Model from the File menu at the top of the open Simulink Library Browser window or by pressing Ctrl-N.

• Insert four Fcn Blocks from the Simulink/User-Defined Functions library. We will build the equations for , , , and employing these blocks.

• Change the label of each Fcn block to match its associated function.

• Insert four Integrator blocks from the Simulink/Continuous library. The output of each Integrator block is going to be a state variable of the system: , , , and .

• Double-click on each Integrator block to add the State Name: of the associated state variable. See the following figure for an example. Also change the Initial condition: for (pendulum angle) to "pi" to represent that the pendulum begins pointing straight up.

• Insert four Multiplexer (Mux) blocks from the Simulink/Signal Routing library, one for each Fcn block.

• Insert two Out1 blocks and one In1 block from the Simulink/Sinks and Simulink/Sources libraries, respectively. Then double-click on the labels for the blocks to change their names. The two outputs are for the "Position" of the cart and the "Angle" of the pendulum, while the one input is for the "Force" applied to the cart.

• Connect each output of the Mux blocks to the input of the corresponding Fcn block.

• Connect the output of the and Fcn blocks to two consecutive integrators to generate the cart's position and the pendulum's angle. Your current model should now appear as follows.

Generating the open-loop response

We will now simulate the response of the inverted pendulum system to an impulsive force applied to the cart. This simulation requires an impulse input. Since there is no such block in the Simulink library, we will use the Pulse Generator block to approximate a unit impulse input. Follow the steps given below.

• Open the inverted pendulum model generated above.

• Add a Pulse Generator block from the Simulink/Sources library. Double-click on the block and change the parameters as shown below. In particular, change the Period: to "10". Since we will run our simulation for 10 seconds, this will ensure that only a single "pulse" is generated. Also change the Amplitude to "1000" and the Pulse Width (% of period): to "0.01". Together, these settings generate a pulse that approximates a unit impulse in that the magnitude of the input is very large for a very short period of time and the area of the pulse equals 1.

• Add a Scope block from the Simulink/Sinks library.

• In order display two inputs on the scope, double-click on the Scope block, choose the Parameters icon, and change the Number of axes: to "2".

Extracting a linear model from the simulation

Aside from comparing our simulation model to our prior results, it may also be desirable to extract a linear model for the purposes of analysis and design. Much of the analytical techniques that are commonly applied to the analysis of dynamic systems and the design of their associated control can only be applied to linear models. Therefore, it may be desirable to extract an approximate linear model from the nonlinear simulation model. We will accomplish this from within Simulink.

• To begin, open the Simulink model generated above, Pend_Model.mdl.

• If you generated your simulation model using variables, it is necessary to define the physical constants in the MATLAB workspace before performing the linearization. This can be accomplished by entering the following commands in the MATLAB command window.

M = 0.5;
m = 0.2;
b = 0.1;
I = 0.006;
g = 9.8;
l = 0.3;

• Next choose from the menus at the top of the model window Tools > Control Design > Linear Analysis. This will cause the Linear Analysis Tool window to open.

• In order to perform our linearization, we need to first identify the inputs and outputs for the model and the operating point that we wish to perform the linearization about. First right-click on the signal representing the Force input in the Simulink model. Then choose Linearization Points > Input Point from the resulting menu. Similarly, right-click on each of the two output signals of the model (pendulum angle and cart position) and select Linearization Points > Output Point from the resulting menu in each case. The resulting inputs and outputs should now be identified on your model by arrow symbols as shown in the figure below.

• Next we need to identify the operating point to be linearized about. From the Operating Point: menu choose Linearize At... > Trim model... as shown in the figure below. This will open the TRIM MODEL tab. Within this tab, select the Trim button indicated by the green triangle. This will create the operating point op_trim1.

• Since we wish to examine the impulse response of this system, return to the EXACT LINEARIZATION tab and choose New Impulse from the Plot Result: drop-down menu near the top window as shown in the figure below.

• Finally, choose op_trim1 from the Operating Point: drop-down menu and click the Linearize button indicated by the green triangle. This automatically generates an impulse response plot and the linearized model linsys1.

• In order to compare the results to those plots generated in the Inverted Pendulum: System Analysis page, it is necessary to change the -axis scaling. This can be achieved from by choosing Properties from the right-click menu. The resulting window should then appear as follows, where the top plot is response of the pendulum angle and the bottom plot is the response of the cart position.

Implementing PID control for the nonlinear model

In the Inverted Pendulum: PID Controller Design page a PID controller was designed with proportional, integral, and derivative gains equal to 100, 1, and 20, respectively. To implement this closed-loop system, we will start with one of our plant models from the Inverted Pendulum: Simulink Modeling page. Following the steps below, we will build a closed-loop model with reference input of pendulum position and a disturbance force applied to the cart.

• To begin, open either of the Simulink models generated previously, Pend_Model.mdl.

• Insert two Add blocks from Simulink/Math Operations library.

• Change the List of signs: of one of the Add blocks to "+-".

• Insert a Constant block from Simulink/Sources library. Change its value to 0. This is the reference input that corresponds to the pendulum vertically upward. Note, the model (and the rest of the pages in this example) define the pendulum angle to equal pi when pointing straight up.

• Insert a PID Controller block from the Simulink/Continuous library.

• Edit the PID block by doubleclicking on it. Change the Proportional (P): gain to "100", leave the Integral (I): gain as "1", and change the Derivative (D): gain to "20".

Attachment:- Inverted-Pendulum.rar

MATLAB, Engineering

  • Category:- MATLAB
  • Reference No.:- M92555692
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in MATLAB

Assignment matlab programmingusing appropriate matlab

Assignment: MatLab Programming Using appropriate MatLab syntax, write the code required to analyse and display the data as per the problem description. The order of the MatLab Program should be as follows: Variables and ...

Assignment -matlab codes and simulated model in

Assignment - Matlab codes and simulated model in simulink/matlab and truetime. 1. Matlab codes and simulink model for pid controller optimization using particle swarm optimization (PSO) my plant is integer order 1000/(s^ ...

Question - verify the attached paper with matlab and get

Question - Verify the attached paper with matlab and get all the results in the paper and explain step by step the matlab code. Paper - Improving Massive MIMO Belief Propagation Detector with Deep Neural Network. Attachm ...

Question a safe prime is a prime number that can be written

Question : A safe prime is a prime number that can be written in the form 2p + 1 where p is also a prime number. Write a MATLAB script file that finds and displays all safe primes between 1 and 1000.

What comparison of means test was used to answer the

What comparison of means test was used to answer the question

Assignmentq1 find the laplace transforms of the following

Assignment Q.1 Find the Laplace transforms of the following functions: (a) t 2 + at + b and (b) sin(2nΠt/T) Q.2 Find f (t) for the following F(s) = α[ f (t)]. (i) 5/(s + 3), (ii) 1/s 2 + 25, (iii) 1/s(s+1) Q.3 Find the L ...

Suppose that a student has the option of enrolling for a

Suppose that a student has the option of enrolling for a single elective during a term. The student must select a course from a limited list of options: "English, " "History, " "Biology, " "Computer, " or "Math." Constru ...

Discrete optimisation- solve the following two problems

Discrete Optimisation - Solve the following two problems with both exhaustive enumeration and branch and bound - Problem 1 is a mixed integer linear optimisation problem (the problem has both discrete and continuous vari ...

Suppose that you have used some concept learning algorithm

Suppose that you have used some concept learning algorithm to learn a hypothesis h1 from some training data. You are interested in knowing the accuracy that the hypothesis can be expected to achieve on the underlying pop ...

Assignment -data is given on which want to do computational

Assignment - Data is given on which want to do computational production planning using Metaheuristic MATLAB Programming: 1) Ant Colony Algorithm on both Partial and Total Flexible Problem. 2) Bee Algorithm on both Partia ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As