Electrical and Computer Engineering Assignment help-Spring 2017-2018 Engineering Computation and Linear Algebra Programming Project
Department of Electrical and Computer Engineering
Spring 2017-2018
Engineering Computation and Linear Algebra
Programming Project
Please read this paragraph carefully:
Choose one project; Electrical Project or Mechanical Project
Option 1: Electrical Project
Write a program in MATLAB to analyze the circuit of a ladder filter as shown in the circuit below. The circuit contains of n coils, n-1 capacitors, two resistors (R1 and R2) and AC voltage source in the form of cos() V Vmwt .
The following requirements should be fulfilled
1. The minimum number of coils is 3
2. If the number of coils is n, the number of capacitors must be n-1. The user will be prompted to enter the correct number of capacitors if it is different from n-1
3. The values of all resistors, coils and capacitors must be real and positive
It is required to find the mesh currents based on Ohm’s law: V ZI where V is the supply voltage, Z is the impedance matrix and I is the vector representing the mesh currents.
Sample example 1 (note: The red colour represents the data entered by the user)
Enter values of the two resistances in ohm, [R1 R2]= [1 100]
=============================================================================
Enter the inductance values in Henry, [L1…Ln]= [0.1 0.1 0.5]
=============================================================================
Enter the capacitance values in Farads, [C1…Cn-1]= [0.01 0.01]
==============================================================================
Enter the amplitude of the voltage source in volt, Vmag= 10
Enter the phase of the voltage source in degree, Vphase= 0
Enter the frequency of the voltage source in rad/s, Freq= 100
==============================================================================
==============================================================================
The impedance matrix to solve the mesh current is:
1.0e+02 *
0.0100 + 0.0900i 0.0000 + 0.0100i 0.0000 + 0.0000i
0.0000 + 0.0100i 0.0000 + 0.0800i 0.0000 + 0.0100i
0.0000 + 0.0000i 0.0000 + 0.0100i 1.0000 + 0.4900i
The voltage vector to solve the mesh current is:
10
0
0
Mesh currents
Magnitude Phase
1.1197 -83.5704
0.1400 96.4874
0.0013 -19.6175
Sample example 2 (note: The red colour represents the data entered by the user)
Enter values of the two resistances in ohm, [R1 R2]= [5 25]
==============================================================================
Enter the inductance values in Henry, [L1…Ln]= [0.001 0.001 0.001 0.001]
==============================================================================
Enter the capacitance values in Farads, [C1…Cn-1]= [0.005 0.005 0.005]
==============================================================================
Enter the amplitude of the voltage source in volt, Vmag= 10
Enter the phase of the voltage source in degree, Vphase= 60
Enter the frequency of the voltage source in rad/s, Freq= 100
==============================================================================
==============================================================================
The impedance matrix to solve the mesh current is:
5.0000 – 1.9000i 0.0000 + 2.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
0.0000 + 2.0000i 0.0000 – 3.9000i 0.0000 + 2.0000i 0.0000 + 0.0000i
0.0000 + 0.0000i 0.0000 + 2.0000i 0.0000 – 3.9000i 0.0000 + 2.0000i
0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 2.0000i 25.0000 – 1.9000i
The voltage vector to solve the mesh current is:
5.0000 + 8.6603i
0.0000 + 0.0000i
0.0000 + 0.0000i
0.0000 + 0.0000i
Mesh currents
Magnitude Phase
1.9818 65.7776
1.3795 64.9396
0.7090 62.5965
0.0566 -23.0574
Option 2: Mechanical Project
Write a program in MATLAB to analyze the spring-mass oscillator system shown in the following figure. Spring-mass systems play an important role in mechanical and mechatronic engineering systems. Here, we consider a system consisting of n masses, suspended vertically by a series of spring (ki, i=1,2,…,n) as shown in figure at the right. Initially, at the moment these masses are attached to the springs, each spring elongates by a certain amount due to the gravitational force, which therefore brings the overall mechanical structure to a static equilibrium position (rest position). The application of an external force Fi (i=1,2,…,n) on the ith mass causes the whole spring-mass system moving along the vertical direction (up or down depending on the direction of the force). In other words, any external force applied to one mass would result in a new equilibrium for all masses. The variable xi (i=1,2,…,n) next to the ith mass indicates the amount of displacement of the ith mass from its initial equilibrium position (when the force Fi =0) due to one or more external forces applied. At the rest position (when no force is applied), the displacement of each mass is assumed to be 0.
In this project, it is required to determine the amount of static displacement (displacement at the steady-state) of each mass in the system from its initial equilibrium state (xi=0, for i=1,2,…,n) when three external (constant) forces are applied on three specific masses: the first mass (mass 1) and the last mass (mass n), and another intermediate mass selected automatically by your program as follows:
– If the number of masses n is even, then the intermediate mass is n/2
– If the number of masses n is odd, then the intermediate mass is (n+1)/2
For example, if the number of masses is 5, then the three forces should be applied on masses 1, 3, and 5. If the number of masses is 4, then the three forces should be applied on masses 1, 2, and 4. For the particular case of 3 masses, each of the three forces should be applied to one mass.
To find the mass displacements, it is required to write the steady-state equation for each mass using Hooke’s law. The set of n equations obtained can then be written as =. where ×1 is the force vector, × is the spring constant matrix and ×1 is the mass displacement vector.
An example showing how to derive the steady-state equations for a system with three masses and springs is given at the end (Page 5).
The following requirements should be fulfilled
4. The number of springs is equal to the number of masses. The minimum number of springs is 3. The user will be prompted to enter the correct number of springs if it is less than 3.
5. The values of all spring constants must be real and positive.
6. Spring constant values should not be all zeros
7. The values of the three forces must be real.
Sample example 1 (note: The red colour represents the data entered by the user)
Enter the values of spring constants in “N/m”, [k1…kn]=[700 300 550]
=============================================================================
Enter the three forces in “N”, [F1 F2 F3]=[-4 2 5]
==========================================================================================================================================================
The spring constant matrix is:
1000 -300 0
-300 850 -550
0 -550 550
The force vector to solve the mass position is:
-4
2
5
The total displacement (in meter) by which each mass is going to move is:
0.0043
0.0276
0.0367
Sample example 2 (note: The red colour represents the data entered by the user)
Enter the values of spring constants in “N/m”, [k1…kn]=[350 600 280 130 800]
=============================================================================
Enter the three forces in “N”, [F1 F2 F3]= [2.5 3.2 4]
==========================================================================================================================================================
The spring constant matrix is:
950 -600 0 0 0
-600 880 -280 0 0
0 -280 410 -130 0
0 0 -130 930 -800
0 0 0 -800 800
The force vector to solve the mass position is:
2.5
0
3.2
0
4
The total displacement (in meter) by which each mass is going to move is:
0.0277
0.0397
0.0654
0.0962
0.1012
Note:
1- Comment your code thoroughly otherwise marks will be deducted.
2- This project should be done in groups. Each group should be either 3 or 4 students.
3- If two or more groups copy from each other, they will both receive zero.
4- Each group will demonstrate the project. The professor will ask each student in the group to explain the project code.
5- The mark of each student within the same group might be different and will vary between 0 and 10.
6- Your code must compile on MATLAB. If your code does not compile for any reason, you will receive a grade of zero automatically.
The deadline to submit the assignment is Sunday May 6, 2018 at 11:55 pm. There will be no deadline extensions. Late assignments will not be accepted. Submit only the source files and write your name and ID as a comment inside the file. Only one submission is required from each group. Submitting the project to the professor by email is not acceptable and will not be marked.
Example for writing the steady-state equations: Consider the following spring-mass system with three springs and masses.
To model the above system, it is required to find the resultant force acting on each mass individually.
Equilibrium equation (steady-state equation) for each mass individually:
1. Mass 1
Mass 1 is subject to three forces: an external force 1, and two forces due to the springs 1 and 2.
Σ=0 ⇒ 1+2−1=0 ⇒ 1+2(2−1)−11=0 ⇒(1+2)1−22=1 (1)
2. Mass 2
Mass 2 is subject to three forces: an external force 2, and two forces 2 and 3 due to the springs 2 and 3, respectively.
Σ=0 ⇒ 2+3−2=0 ⇒ 2+3(3−2)−2(2−1)=0
⇒−21+(2+3)2−33=2 (2)
3. Mass 3
Forces acting on mass 3 are: an external force 3, and an opposing force 3 exerted by the third spring 3.
Σ=0 ⇒ 3−3=0 ⇒ 3−3(3−2)=0
⇒−32+33=3 (3)
The above equilibrium equations obtained for the three masses form a system of linear equations as follows: { (1+2)1−22=1 −21+(2+3)2−33=2−32+33=3
Which can be rewritten in the matrix form as [1+2−20−22+3−30−33][123]=[123]
So, =[1+2−20−22+3−30−33] =[123] =[123]
Remark: it can be seen that the equations above do not depend on masses mi because of the fact that at the steady-state regime all terms 22=0 ∀.