0% found this document useful (0 votes)
155 views

Matlab Group Project

matlab group project done by EAU Students

Uploaded by

Noah Cedric
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
155 views

Matlab Group Project

matlab group project done by EAU Students

Uploaded by

Noah Cedric
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

School of Engineering

BSc. Aeronautical Engineering


Matlab Project

Basel Chaker 20171141373


Cedric Esonga 20171141086
Christian Lesmo 20171141286
Hussam Merghani 20171141199
Tasneem AlSamhouri 20172141720
Introduction to Programming ENG2220
Spring Semester 2018
Lecturer: Mr Imran

Due date: 30 May 2018


Word Count: 1313
30th May 2018 Intro to Programming Mr.Imran

Table of Contents
Introduction: ................................................................................................................................................. 3
What is MATLAB?...................................................................................................................................... 3
About the program: .................................................................................................................................. 3
Objective of the project: ............................................................................................................................... 4
Project work Distribution: ......................................................................................................................... 4
Report work Distribution: ......................................................................................................................... 4
Literature Review: ......................................................................................................................................... 5
Background Information on the method: ................................................................................................. 5
Methodology:................................................................................................................................................ 6
Steps to solve: ........................................................................................................................................... 6
Coding: .......................................................................................................................................................... 7
Conclusion: .................................................................................................................................................. 10
References .................................................................................................................................................. 11

Figure 1: Table of vectors.............................................................................................................................. 6


Figure 2: T vs S graph .................................................................................................................................... 7
Figure 3: T vs. S with best fit line graph ........................................................................................................ 7
Figure 4: Best fit line and graph. ................................................................................................................... 8
Figure 5: Acceleration vs t graph .................................................................................................................. 9
Figure 6: S vs t graph ..................................................................................................................................... 9
Figure 7: Confirmation of Graph 5 ................................................................................................................ 9
Figure 8: Confirmation of Graph 7 ................................................................................................................ 9

2
30th May 2018 Intro to Programming Mr.Imran

Introduction:

What is MATLAB?

MATLAB® is a software program used to analyze and design the systems and products
transforming our world. MATLAB is in automobile active safety systems, interplanetary
spacecraft, health monitoring devices, smart power grids, and LTE cellular networks. It is used for
machine learning, signal processing, image processing, computer vision, communications,
computational finance, control design, robotics, and much more. The MATLAB platform is
optimized for solving engineering and scientific problems. The matrix-based MATLAB language
is the world’s most natural way to express computational mathematics. Built-in graphics make it
easy to visualize and gain insights from data. A vast library of prebuilt toolboxes lets the user get
started right away with algorithms essential to their domain. The desktop environment invites
experimentation, exploration, and discovery. These MATLAB tools and capabilities are all
rigorously tested and designed to work together. MATLAB helps take ideas beyond the desktop.
The analyses can be run on larger data sets and scale up to clusters and clouds. MATLAB code
can be integrated with other languages which enable users to deploy algorithms and applications
within web, enterprise, and production systems (MATLAB, n.d.).

About the program:

The Force Resultant Calculation Program

As the name suggests, The Force Resultant Calculation Program is a program that can find the
maximum number of resultant forces of both 2D and 3D objects and is also capable of plotting a
graph in relation to the values acquired. The resultant forces of these objects are found using the
forces adjacent angle or using the method of position vectors, in the most efficient way.Due to the
formulas and functions being pre-included into the program, all the user has to do is input the
values in their acquainted positions and an accurate output would be acquired.This program is
extremely effective and efficient especially for those who require an accurate answer in the fastest
way possible, where the hand solution working is not an issue or just for re-checking answers.
example: Students, to re-check their answers or If teachers don’t have a pre-solution to a test, this
program could be used to check the final answer without any waste of time.

3
30th May 2018 Intro to Programming Mr.Imran

Objective of the project:


Project work Distribution:
Basel: Coding and first attempt

Cedric: Coding and first attempt with second order polynomial.

Christian: Coding and second attempt with third order polynomial.

Hussam: Acceleration and speed inputs.

Tasneem: Proving the attempts are all equivalent through the use of plotting.

Report work Distribution:


Basel: Introduction

Cedric: Literature and coding

Christian: Coding

Hussam: Methodology

Tasneem: Conclusion

4
30th May 2018 Intro to Programming Mr.Imran

Literature Review:
Background Information on the method:
The relationships between a particle’s position, s, velocity, v, and acceleration, a, over time
are all related. When the relationship between a particle’s velocity and time is described by a
mathematical equation, that equation can be integrated to obtain the particle’s position and
differentiated to determine the particle’s acceleration. Equations are great for describing idealized
situations, but they don't always cut it. Sometimes you need a picture to show what's going on —
a mathematical picture called a graph. Graphs are often the best way to convey descriptions of real
word events in a compact form.

An example of fitting a polynomial to velocity data can clearly show us the importance
and the relation of plotting and having graphs in an equation. A data recorder connected to the
speedometer is helpful when plotting a driver’s road trip while he accelerates and decelerates
throughout the time span of the whole journey. Having a linear graph or even a curve graph will
ease the readability of the numbers. As having someone read numbers out of the two columns or
two rows won’t necessarily mean that the person understands what those numbers are saying and
what do they mean, while having that same person look at a well-plotted graph and realize when
the car is accelerating, decelerating or at rest in a much quicker and simple way. MATLAB helps
us plot those graphs using codes. The graphs can vary from being a smooth linear curve all the
way to be a correlation graph ion certain things and certain situations. Graphs can show the
increasing velocity, the time rested, the decreasing acceleration and even the distance of the
journey of a specific object or device. Curve-fitting is the name of having codes on MATLAB to
draw graphs or to illustrate certain things. This whole process goes under the name curve-fitting
and relating s-t, v-t and a-t graphs. Writing equations in the format of codes using special wording
and special characters on MATLAB will then output a well-plotted graph that can be used in
researches.

5
30th May 2018 Intro to Programming Mr.Imran

Methodology:
Steps to solve:
A driver on a straight track accelerates his car from 0 to 75 mph in 14 seconds, and then allows
the car to begin to slow. A data recorder connected to the speedometer recorded the data shown
below. Since the car is moving along a straight path, the car’s speed and velocity are equal
(Anon., n.d.).

Figure 1: Table of vectors.

1. First attempt with simple vectors and plotting


2. First attempt with second order polynomial, regression and plotting.
3. Second attempt through third order polynomial and plotting
4. Second attempt through derivation and integration of constant (b) to arrive at
acceleration and speed graphs.
5. Final union of more functions to be able to prove that the results are correct event
through the use of different functions.

6
30th May 2018 Intro to Programming Mr.Imran

Coding:
%FIRST ATTEMPT
%Time and Velocity vectors, plotting the v-t graph
t=0:20;
v=[0 1 4 8 14 21 28 35 43 51 58 64 69 73 75 75 73 68 60 49 35]
plot(t,v,'o');
xlabel('{\bf t(sec)}');
ylabel('{\bf v(mph)}');

Figure 2: T vs S graph

%Inline function with second order polynomial


F=inline('b(1).*t.^2 + b(2).*t','b','t');
%Best-line of fit
b=nlinfit(t,v,F,[0 0](b);
%Predicted velocity calculations to assess if the regression equation fits
%the data provided.
v_p=b(1).*t.^2 +b(2).*t;
subplot(1,2,1);
plot(t,v,'o',t,v_p);
xlabel('{\bf t(sec)}');
ylabel('{\bf v(mph)}');
legend('v','v_p',2);

Figure 3: T vs. S with best fit line graph

7
30th May 2018 Intro to Programming Mr.Imran

%SECOND ATTEMPT
%Inline function with third order polynomial
F=inline('b(1).*t.^3 + b(2).*t.^2+ b(3).*t','b','t');
%Best-line of fit
b=nlinfit(t,v,F,[0 0 0]);
%Predicted velocity calculations to assess if the regression equation fits
%the data provided.
v_p=b(1).*t.^3 + b(2).*t.^2+ b(3).*t;
subplot(1,2,2);
plot(t,v,'o',t,v_p);
xlabel('{\bf t(sec)}');
ylabel('{\bf v(mph)}');
legend('v','v_p',2);

Figure 4: Best fit line and graph.

%Convert b Matlab polynomial vector


b(4)=0;

%Take the derivative of b for an equation of a


b_a = polyder(b);

%Calculate a at each value of t available


a = b_a(1).*t.^2 + b_a(2).*t + b_a(3);

%Simplify the units by building in the conversion from hours to seconds.


a = a ./ 3600;

%Integrate b to find the equation for s.


b_s = polyint(b)

%Calculate s at each value of t


s = b_s(1).*t.^4 + b_s(2).*t.^3 + b_s(3).*t.^2 + b_s(4)*t;

%Simplify the units by building in the conversion from hours to seconds.


s = s ./ 3600

8
30th May 2018 Intro to Programming Mr.Imran

Figure 5: Acceleration vs t graph Figure 6: S vs t graph

%Plot the results in a new figure.


figure;
subplot(1,2,1);
plot(t,a,'o');
xlabel('{\bf t}');
ylabel('{\bf a}');

subplot(1,2,2);
plot(t,s,'o');
xlabel('{\bf t)}');
ylabel('{\bf s}');

Figure 8: Confirmation of Graph 7


Figure 7: Confirmation of Graph 5

9
30th May 2018 Intro to Programming Mr.Imran

Conclusion:
Various variables where set to run using the proprietary algorithm and the results were displayed
using graphical representation. As time went on the solution became clearer as more data was
being gathered through rigorous testing. Improvements and slight adjustments were added to
perfect the code and allow for more accurate and truthful data. One of the main problems faced
was the “nlinfit” function was no included in our current version of MATLAB because the
“Statistics and Machine Learning Toolbox” was missing. One of the many modifications we
implemented was figuring out a method to increase the number of variables that were being input
to be able to draw a proper thesis and conclude a definitive answer. Overall MATLAB is very
essential in helping various occupations compile and configure information to be able to reach a
simple and effective solution.

10
30th May 2018 Intro to Programming Mr.Imran

References
Anon., n.d. Using MATLAB for Statics and Dynamics. [Online]
Available at: http://www.secs.oakland.edu/~latcha/EGR280/StatDynMatlab.pdf

MATLAB, n.d. Mathworks. [Online]


Available at: https://www.mathworks.com/products/matlab.html
[Accessed 12 May 2018].

11

You might also like