Development of New Mathematical and Engineering Programs – Lab Report Example

Lab Report Logic and Programming Computational mathematics (MATLAB SciLab)
Mathematical operations are usually simulated in dynamic language simulations such as Mat-Lab and Sci-Lab. These applications software are useful in the development of rapid prototypes for technical activities such as Engineering. Development of new mathematical and engineering programs in this project will be developed using Sci-Lab and Mat-Lab. Mat-Lab program was used to perform different mathematical tasks. Different codes were used for different operations as shown in the Appendices attached herein. The outputs of the programs are represented in form of diagrams. The diagrams are also attached in the report.
Table of Contents
The Mat-Lab program is a very useful tool in solving mathematical problems. The program is not only used in Mathematics, but also widely used in simulating engineering tasks. The use of this program has extremely made engineering productions easier than ever before. It is much easier to use the Mat-Lab and Sci-Lab as it requires one to also instruct the program codes. This area of study is very essential as it can enable a mathematician to transform mathematical calculations and operations into relevant form for use in actual working environment (Haidekker 2013, p47). Both Mat-Lab and Sci-Lab display similar results but use different programming syntax (Wouwer, Saucez and Vilas 2014, p52). The choice of which program to use in simulation depends on the programmer’s knowledge and experience.
1.1. Scope
The scope of this project is to compare two programs, i.e., one in Matlab and the other in SciLab. It thus contains two scripts in each of the languages along with their outputs.
1.2. Objectives
The main aim of this project is to demonstrate the use of programing languages in simulation of mathematical and engineering problem solutions.
2. Methods
The method used in this study is quantitative analysis using familiar mathematical and engineering problems and applying the variables and equations in the scripts (Campbell, Chancelier and Nikoukhah 2006, p38). The results are presented in plotted graphs as a summary of the simulated solutions.
2.1 Task 1: Calculation of velocities and accelerations
Task 1 involved programming of Mat-Lab and Sci- Lab programs. The programs written for Mat-Lab and Sci- Lab are shown appendices 1 and 2 respectively. The outputs for the Mat-Lab and Sci-Lab for this task are shown in the figures 1 and 2 respectively.
2.2 Task 2 Workshop operations.
Task 2 involved various workshop operations. Two workshops were conducted, i.e. Workshop 4 and Workshop 5, Workshop 6, Workshop 7, Workshop 8 and Workshop 9. These workshop operations involved different mathematical operations. For instance, in Workshop 4, a Mathematical operation is performed where the prices of houses are determined based on the area floor. The program for this operation is shown in Appendix 3.
In Workshop 5, displacement, velocities and accelerations of a moving object were determined. The program for these workshop operations is as shown in Appendix 4. The software calculated the displacements, velocities and accelerations using differentiation and integration methods. The outputs for differentiation and integration are as shown in figure 4 and figure 5 respectively. Also a trapezoidal method was used to determine velocities. The result is shown in Figure 6.
In workshop 6, Mat-Lab demonstration of derivative and trigonometric formula was done. The programs for these operations are as shown in Appendix 5. A plot of the results obtained is displayed in figure 7.
In Workshop 7, a mathematical operation involving Trial Number vs Percent Heads was carried out. The program for this operation is as shown in Appendix 6. The resulting histogram is shown in figure 8.
In Workshop 8, a program was used to generate two variables, station (mm) and displacement (mm). The data generated is shown in Appendix 7. The program then used the data generated to plot a graph as shown in figure 9.
In Workshop 9, a program was used to generate salaries of different staff members as shown in appendix 8. The software then plotted a graph of salary distribution as shown in figure 10.
The project was successful in the analysis and demonstration of the possibility of programming the mathematical solutions. Both Mat-Lab and Sci-Lab scripts worked successfully and the results. The codes used for the various operations are shown in the Appendix section. The outputs for the programs are shown in the diagrams attached.
In the project, the Mat-Lab and Sci-Lab programs worked successfully, and showed that confirmed that indeed, Mathematical computations and Engineering problems can best be solved through programming. The solution displayed is the ultimate result, regardless of the software used in developing the script. In future, more studies ought to be done to compare results of more software programs to be used as alternatives.
Appendix 1: Mat-Lab Script
clear all;         %deletion of the former variables
 v01 = 0;              %Initial speed
dt1 = 0.10;            %Time step
t1 = 0: dt: 60;         %Simulation for 10 seconds.
g1 = 9.80;             %gravitation force
g1 = 0.10;             % coefficient of friction force
m1 = 1.0;               %mass - 1 kg.
v (1) = v0;           %Setting the initial velocity.
 for i1 = 1 : 1 : (length(t1) - 1),
    a = g1 - (b / m1) * v1 (i1);    %Calculating the acceleration.
v(i1 + 1) = v1(i1) + a * dt1;%Getting the velocity by approximating integration.
 %Exact Solution.
Vexact = (m1 * g1 / b) * (1 – exp (-t1 * b / m1));
plot (t1, v1, t1, vexact);
legend (Approx velocity,Exact velocity);
xlabel (Time);
ylabel (Velocity);
Appendix 2: Sci-Lab Script
// Constants
DeltaT = 0.01; // 100Hz sample
w = (50 / 60) * 2 * %pi; // 50 RPM -> radians persec
L = 8/100; // 8 cm -> meters
g = 9.81; // Earth gravity in ms^-2
N = 1000; // Number of samples
sig_w = 0.00001;
sig_v = 1;
ww = sig_w * rand(3, N, normal);
vv = sig_v * rand(2, N, normal);
x = zeros (3, N);
x (:,1) = [0, w * DeltaT,0];
z = zeros (2, N);
F = [1 1 0; 0 1 1; 0 0 1];
// All nonlinearities are in the output equation
function h = output_equation(theta, omega, g, L)
h = [g * cos (theta); g * sin (theta) + omega.*omega * L];
for i=2:N,
x(:,i) = F * x(:,i-1) + ww(:,i);
if (i>N/4) & (i