This document describes a computer based modelling project to simulate temperature distribution across a plate. The author developed a MATLAB script and graphical user interface (GUI) to allow users to input parameters and visualize the iterative temperature corrections. Key aspects included designing the GUI, implementing a method to correct temperatures using matrix operations based on Laplace's equation, and addressing challenges in modelling a central conducting hole. The completed project allows flexible adjustment of simulation variables and outputs clear graphs of the temperature distribution.
3d tracking : chapter2-1 mathematical toolsWoonhyuk Baek
This document discusses various mathematical tools used for monocular model-based 3D tracking of rigid objects, including camera representation using the pinhole camera model and calibration matrix, methods for estimating the external camera parameters matrix like DLT and PnP, and techniques for pose estimation, robust estimation, and Bayesian tracking. It covers topics like camera parameterization using Euler angles, quaternions and exponential maps, and algorithms for minimizing reprojection error like linear least squares and Newton-based methods. It also describes M-estimators and RANSAC for robust estimation in the presence of outliers.
This document presents two numerical methods for evaluating integrals involving the linear-shape function times the 3D Green's function on a plane triangle. The conventional method splits the integral into an analytical and numerical part, while the alternative method proposed evaluates the integral fully numerically. Numerical results show the alternative method is conceptually simpler, easier to implement, and achieves similar or better accuracy compared to the conventional method.
A simple finite element solver for thermo-mechanical problems - margonari eng...Scilab
In this paper we would like to show how it is possible to develop a simple but effective finite element solver to deal with thermo-mechanical problems. In many engineering situations it is necessary to solve heat conduction problems, both steady and unsteady state, to estimate the temperature field inside a medium and, at the same time, compute the induced strain and stress states.
To solve such problems many commercial software tools are available. They provide user-friendly interfaces and flexible solvers, which can also take into account very complicated boundary conditions, such as radiation, and nonlinearities of any kind, to allow the user to model the reality in a very accurate and reliable way.
However, there are some situations in which the problem to be solved requires a simple and standard modeling: in these cases it could be sufficient to have a light and dedicated software able to give reliable solutions. Moreover, other two desirable features of such a software could be the possibility to access the source to easily program new tools and, last but not least, to have a cost-and-license free product. This turns out to be very useful when dealing with the solution of optimization problems.
Keeping in mind these considerations, we used the Scilab platform and the gmsh (which are both open source codes) to show that it is possible to build tailored software tools, able to solve standard but complex problems quite efficiently.
METHOD FOR A SIMPLE ENCRYPTION OF IMAGES BASED ON THE CHAOTIC MAP OF BERNOULLIijcsit
In this document, we propose a simple algorithm for the encryption of gray-scale images, although the
scheme is perfectly usable in color images. Prior to encryption, the proposed algorithm includes a pair of
permutation processes, inspired by the Bernoulli mapping. The permutation disperses the image
information to hinder the unauthorized recovery of the original image. The image is encrypted using the
XOR function between a sequence generated from the same Bernoulli mapping and the image data,
obtained after two permutation processes. Finally, for the verification of the algorithm, the gray-scale Lena
pattern image was used; calculating histograms for each stage alongside of the encryption process. The
histograms prove dispersion evolution for pattern image during whole algorithm.
The results of an experiment can be presented as a data table or as an equation that represents them. In the case of adjusting a polynomial, Excel allows us to change its degree and calculates the R2 of the adjusted equation. It is considered that if it is 1 the equation goes through all the experimental points. By adjusting Tungsten resistivity data, it is found that the equations do not go through all the points (even with R2 = 1), which is verified by calculating the differences for each point. In those cases, the best fit is the linear interpolation between consecutive points. The equation adjusted by Excel, Matlab or Origin requires checking if it corresponds to the minimum in the sum of squared differences, it is possible that it can be reduced by changing the coefficients values.
This document presents the results of an experiment and simulation investigating the properties of turbulent jets. Laser-induced fluorescence and particle image velocimetry were used to capture experimental data, while MOBILE software was used to simulate jets. Inlet velocity, virtual origin, and other properties were estimated from the experimental and simulation data using image processing and analysis in MATLAB. The results from experiment and simulation were found to correspond reasonably while some error was present.
This document summarizes a student project modeling road traffic dynamics. The project models the flow of cars in lanes of a motorway over time using arrays to represent velocity and separation. The program calculates acceleration for each car based on target speed and separation, storing values over multiple time increments to model driver reaction time. Graphs of average velocity, separation and traffic density over time demonstrate car behavior and the effects of changing parameters. The program works as intended but could be improved with additional realism factors like curved roads or weather conditions.
1) The document presents the analysis of heat transfer through a triangular fin using finite difference methods. Temperature profiles were calculated at 8 nodes along the fin using energy balance equations and a numerical solution in Mathcad.
2) The temperatures decrease along the fin from 115°C at the base to 31.55°C at the tip. The effectiveness of the fin is 2.58 and efficiency is 50.5%.
3) The total heat flow rate at the base is 824.807 W, which is equal to the sum of the convective heat transfer rates calculated at each node.
3d tracking : chapter2-1 mathematical toolsWoonhyuk Baek
This document discusses various mathematical tools used for monocular model-based 3D tracking of rigid objects, including camera representation using the pinhole camera model and calibration matrix, methods for estimating the external camera parameters matrix like DLT and PnP, and techniques for pose estimation, robust estimation, and Bayesian tracking. It covers topics like camera parameterization using Euler angles, quaternions and exponential maps, and algorithms for minimizing reprojection error like linear least squares and Newton-based methods. It also describes M-estimators and RANSAC for robust estimation in the presence of outliers.
This document presents two numerical methods for evaluating integrals involving the linear-shape function times the 3D Green's function on a plane triangle. The conventional method splits the integral into an analytical and numerical part, while the alternative method proposed evaluates the integral fully numerically. Numerical results show the alternative method is conceptually simpler, easier to implement, and achieves similar or better accuracy compared to the conventional method.
A simple finite element solver for thermo-mechanical problems - margonari eng...Scilab
In this paper we would like to show how it is possible to develop a simple but effective finite element solver to deal with thermo-mechanical problems. In many engineering situations it is necessary to solve heat conduction problems, both steady and unsteady state, to estimate the temperature field inside a medium and, at the same time, compute the induced strain and stress states.
To solve such problems many commercial software tools are available. They provide user-friendly interfaces and flexible solvers, which can also take into account very complicated boundary conditions, such as radiation, and nonlinearities of any kind, to allow the user to model the reality in a very accurate and reliable way.
However, there are some situations in which the problem to be solved requires a simple and standard modeling: in these cases it could be sufficient to have a light and dedicated software able to give reliable solutions. Moreover, other two desirable features of such a software could be the possibility to access the source to easily program new tools and, last but not least, to have a cost-and-license free product. This turns out to be very useful when dealing with the solution of optimization problems.
Keeping in mind these considerations, we used the Scilab platform and the gmsh (which are both open source codes) to show that it is possible to build tailored software tools, able to solve standard but complex problems quite efficiently.
METHOD FOR A SIMPLE ENCRYPTION OF IMAGES BASED ON THE CHAOTIC MAP OF BERNOULLIijcsit
In this document, we propose a simple algorithm for the encryption of gray-scale images, although the
scheme is perfectly usable in color images. Prior to encryption, the proposed algorithm includes a pair of
permutation processes, inspired by the Bernoulli mapping. The permutation disperses the image
information to hinder the unauthorized recovery of the original image. The image is encrypted using the
XOR function between a sequence generated from the same Bernoulli mapping and the image data,
obtained after two permutation processes. Finally, for the verification of the algorithm, the gray-scale Lena
pattern image was used; calculating histograms for each stage alongside of the encryption process. The
histograms prove dispersion evolution for pattern image during whole algorithm.
The results of an experiment can be presented as a data table or as an equation that represents them. In the case of adjusting a polynomial, Excel allows us to change its degree and calculates the R2 of the adjusted equation. It is considered that if it is 1 the equation goes through all the experimental points. By adjusting Tungsten resistivity data, it is found that the equations do not go through all the points (even with R2 = 1), which is verified by calculating the differences for each point. In those cases, the best fit is the linear interpolation between consecutive points. The equation adjusted by Excel, Matlab or Origin requires checking if it corresponds to the minimum in the sum of squared differences, it is possible that it can be reduced by changing the coefficients values.
This document presents the results of an experiment and simulation investigating the properties of turbulent jets. Laser-induced fluorescence and particle image velocimetry were used to capture experimental data, while MOBILE software was used to simulate jets. Inlet velocity, virtual origin, and other properties were estimated from the experimental and simulation data using image processing and analysis in MATLAB. The results from experiment and simulation were found to correspond reasonably while some error was present.
This document summarizes a student project modeling road traffic dynamics. The project models the flow of cars in lanes of a motorway over time using arrays to represent velocity and separation. The program calculates acceleration for each car based on target speed and separation, storing values over multiple time increments to model driver reaction time. Graphs of average velocity, separation and traffic density over time demonstrate car behavior and the effects of changing parameters. The program works as intended but could be improved with additional realism factors like curved roads or weather conditions.
1) The document presents the analysis of heat transfer through a triangular fin using finite difference methods. Temperature profiles were calculated at 8 nodes along the fin using energy balance equations and a numerical solution in Mathcad.
2) The temperatures decrease along the fin from 115°C at the base to 31.55°C at the tip. The effectiveness of the fin is 2.58 and efficiency is 50.5%.
3) The total heat flow rate at the base is 824.807 W, which is equal to the sum of the convective heat transfer rates calculated at each node.
This document provides an introduction to numerical methods and MATLAB programming for engineers. It covers topics such as vectors, functions, plots, and programming in MATLAB. The document is divided into multiple parts that cover various numerical methods topics, including solving equations, linear algebra, functions and data, and differential equations. MATLAB code and examples are provided throughout to demonstrate numerical techniques. The overall goal is to introduce both concepts of numerical methods and MATLAB programming within an engineering context.
This document is a tutorial on programming in User RPL, the programming language of the HP48 calculator. It introduces basic programming concepts like programs, objects, and stack manipulation. It also covers topics like local variables, conditional tests, loop structures, error handling, input/output, and provides exercises for practice. The overall document serves as a guide to learning the fundamentals of programming on the HP48 calculator.
The document summarizes a summer internship project to parallelize the TopFitter program, which calculates constraints on deviations from the Standard Model regarding top quarks, in order to speed up computations. The goal of creating a GPU-parallelized version of TopFitter was accomplished, achieving a 3.5x speedup. However, an unidentified bug remains when running on the largest dataset. As a side project, analysis found that interference prevents detection of non-Standard Model effects from events with non-standard color flows, implying a different approach is needed.
Using Monte Carlo Simulation in Project Estimates by Akram Najjar
The PMI Lebanon is glad to announce that Akram Najjar is the speaker for the a lecture titled “Using Monte Carlo Simulation in Project Estimates” delivered on Thursday, 28 July 2016
Lecture Outline
* Why are single point estimates unreliable and what is the alternative?
* What are distributions and how do we extract random samples from them (using Excel)? Two costing examples.
* How to setup a Monte Carlo Simulation model in a spreadsheet?
* Two PM examples (in detail)
* How to statistically analyze the thousands of runs to reach reliable estimates?
Lecture Objectives
* A Project Manager usually knows how certain parameters (such as duration, resource rates or quantities) behave. However, the PM can almost never define reliable single point estimates for these parameters. The result: many projects fail due to unreliable estimates. The alternative? The PM has to use his/her knowledge of how specific parameters behave statistically. For example, the PM knows that a specific task’s duration is distributed according to the bell shaped curve OR that another is uniformly distributed (flat variation), or triangular, or Beta-PERT, etc. The PM can then use Monte Carlo Simulation (MCS) to arrive at statistically significant and robust results. Monte Carlo Simulation (MCS) is a technique that relies on two processes. Process 1 aims at developing a spreadsheet model that calculates the critical path or the total cost, etc. The calculation is setup in a single row (or Run). This row is then duplicated a large number of times (thousands). Process 2 aims at inserting Excel functions in each of the parameters (durations, costs). In each row (or Run), such functions will provide a sample drawn from a statistical distribution that properly describes the behavior of that parameter. For example, a specific duration follows a Normal (Bell) distribution with an Average A and a Standard Deviation S. The model will then generate for each run and for that duration a different value that conforms with the bell shaped curve as defined (A and S). Each of these thousands of runs will provide the PM with a different “simulation” of the duration or the total cost, etc. By statistically analyzing the thousands of results, the PM can arrive at a robust and reliable estimate. Proprietary Add On’s for Monte Carlo Simulation in Microsoft Project are available. However, it is easy, free and more flexible to use native Microsoft functions to carry out the full simulation. The talk covered all the steps needed for such simulations giving several examples
This document presents the solutions to 4 optimization problems related to software engineering. The problems involve finding the optimal dimensions of boxes, cylindrical structures, and 3D models to minimize costs or pixel usage. Each problem is solved using calculus techniques like taking derivatives and finding critical points to determine maximum or minimum values. The conclusions emphasize how optimization problems are directly applied calculus to calculate extremes of functions subject to conditions.
Application of thermal error in machine tools based on Dynamic Bayesian NetworkIJRES Journal
In recent years, the growing interest toward complex manufacturing on machine tools and the
machining accuracy have solicited new efforts in the area of modeling and analysis of machine tools machining
errors. Therefore, the mathematical model study on the relationship between temperature field and thermal error
is the core content, which can improve the precision of parts processing and the thermal stability, also predict
and compensate machining errors of CNC machine tools. It is critical to obtain the thermal errors of a precision
machine tools in real-time. In this paper, based on Dynamic Bayesian Network (DBN), a pioneering modeling
method applied in thermal error research is presented. The dependence of thermal error and temperature field is
clearly described by graph theory, and the fuzzy classification method is proposed to reduce the computational
complexity, then forming a new method for thermal error modeling of machine tools.
1. The document describes steps to create agro-climatic zones of Tanzania using GIS by analyzing temperature, rainfall, and evapotranspiration data.
2. Key steps include converting vector data to raster, calculating moisture availability, classifying temperature and moisture zones, and combining the zones to produce the final agro-climatic map.
3. Models are created in GIS software to automate the process and allow easy reproduction of the analysis.
This document discusses the finite element method (FEM) for solving partial differential equations and boundary value problems. It provides an overview of the basic steps in FEM, including establishing the weak formulation, discretizing the domain, selecting shape functions, assembling the global stiffness matrix, applying boundary conditions, and solving the system of equations. The document also describes a Matlab FE program that will be used in the course, including the main files and plotting functions. Exercises are provided to test running the program and making advanced plots using figure and axis handles.
This lab report describes a program that creates acceleration profiles based on user input from two buttons. The program initializes registers, runs a debouncer routine to check for button presses, indicates the button pressed with LED lights, and passes a value to create the acceleration profile. Debugging was required to address issues with delays, LED/button implementation, memory access, and ensuring the program functioned as intended. In the end, the program successfully generated the expected acceleration profiles based on button input.
The document provides an overview and tutorial of the MathCAD software program. It discusses (1) what MathCAD is and its main functions, (2) how to open and navigate the MathCAD interface and toolbars, and (3) examples of how to enter equations, plot graphs, and perform calculations in MathCAD. The tutorial aims to explain the basic concepts and features of MathCAD to help readers learn how to use it to solve engineering and mathematics problems.
Smith waterman algorithm parallelizationMário Almeida
This document describes research on parallelizing the Smith-Waterman algorithm for sequence alignment using MPI. Two parallelization techniques are discussed: blocking and blocking with interleaving. Performance models are developed for each technique on linear and 2D torus network topologies. Optimal values for the blocking factor B and interleaving factor I are also derived from the models. The researchers implemented the techniques in C++ and tested performance using different values for B and I.
This document summarizes Matthew Weingarten's senior project on enhancing the UNIX-Based Image Manipulation Library (UIA). Weingarten added new functionality to UIA, most notably implementing the Walsh-Hadamard transform. He also improved documentation, updated deprecated code, and added error checking. Testing showed his Walsh-Hadamard transform implementation matched the output of MATLAB's implementation with zero error. Weingarten concluded the project expanded opportunities for image analysis in UIA and learned about image manipulation, command line use, documentation, and working with large datasets.
This document discusses curve fitting in Matlab. It introduces the Curve Fitting tool and how to use it to fit data to functions. Key aspects covered include importing data into the tool, selecting fitting functions, viewing and analyzing fit results, and plotting residuals. Examples are provided of fitting data to a sine wave, linear function with and without weights, and examining fit confidence bounds and predictions over different ranges. The document provides a tutorial on using Matlab's Curve Fitting tool to model experimental data with functions.
The document discusses several algorithms:
1. Program verification - A technique to mathematically prove that a program's output matches its specifications for any input.
2. Algorithm efficiency - Designing algorithms that are economical with resources like time and memory.
3. Analysis of algorithms - Qualities like correctness, understandability and efficiency.
It then provides examples of algorithms for:
1. Swapping variable values
2. Counting elements that meet a condition in a set
3. Summing a set of numbers
4. Computing factorials
5. Evaluating trigonometric functions like sine
Star Transformation, 12c Adaptive Bitmap Pruning and In-Memory optionFranck Pachot
Besides adaptive joins and adaptive parallel distribution, 12c comes with Adaptive Bitmap Pruning. I’ll describe the case it applies to and which is often not well known: the Star Transformation
Algorithm for computational problematic sitSaurabh846965
A computer requires precise instructions from a user in order to perform tasks correctly. It has no inherent intelligence or ability to solve problems on its own. For a computer to solve a problem, a programmer must break the problem down into a series of simple steps and write program code that provides those step-by-step instructions in a language the computer can understand. This process involves understanding the problem, analyzing it, developing a solution algorithm, and coding the algorithm so the computer can execute it. Flowcharts can help visualize algorithms and problem-solving logic in a graphical format before writing program code.
The document discusses linear programming models and optimization techniques. It covers sensitivity analysis and duality analysis to determine parameter values where a linear programming solution remains valid. It also discusses solving linear programming problems with integer constraints and using network models to solve transportation problems. The document then provides an example of using the simplex method and sensitivity analysis to solve a linear programming problem to maximize profit based on production capacity constraints.
This document provides steps to transfer operational data from an ECS system to Excel for analysis and visualization. Key steps include:
1) Using the ECS interface to select parameters and timeframe for trend data capture.
2) Copying the trend data to the clipboard and pasting into an Excel sheet.
3) Formatting the pasted data into separate columns for analysis and plotting.
4) Creating scatter plots of variables over time and interpreting relationships.
This document outlines Robert Tanner's research project on fracturing of brittle lattice structures under his supervisor Professor Martyn Pavier. The aims are to conduct a literature review on fracturing of brittle lattices, design experiments to demonstrate brittle fracture in solid and lattice structures, perform the experiments, and determine if fracture mechanics can predict failure of a brittle material containing a large lattice structure with cracks. The experiments will use PMMA test specimens with a lattice structure and crack-hole geometries cut using a waterjet cutter. Results and conclusions will analyze whether fracture mechanics can accurately model failure observations and identify potential discrepancies between theory and experiments.
The document reports on a project to determine the validity of using fracture mechanics to predict failure in lattice structures. Lattices with two and four circular unit cells were cut from PMMA and cracks of varying lengths and configurations were introduced. The lattices were loaded in tension and cracks were observed to see if they propagated as predicted. Material properties of PMMA were measured. Critical crack lengths and loads were measured and used to build finite element models to estimate stress intensity factors, which were compared to PMMA's fracture toughness. The stress intensity factors of the cracks were found to be close to or below the fracture toughness, indicating fracture mechanics may not fully predict failure of large lattices.
This document provides an introduction to numerical methods and MATLAB programming for engineers. It covers topics such as vectors, functions, plots, and programming in MATLAB. The document is divided into multiple parts that cover various numerical methods topics, including solving equations, linear algebra, functions and data, and differential equations. MATLAB code and examples are provided throughout to demonstrate numerical techniques. The overall goal is to introduce both concepts of numerical methods and MATLAB programming within an engineering context.
This document is a tutorial on programming in User RPL, the programming language of the HP48 calculator. It introduces basic programming concepts like programs, objects, and stack manipulation. It also covers topics like local variables, conditional tests, loop structures, error handling, input/output, and provides exercises for practice. The overall document serves as a guide to learning the fundamentals of programming on the HP48 calculator.
The document summarizes a summer internship project to parallelize the TopFitter program, which calculates constraints on deviations from the Standard Model regarding top quarks, in order to speed up computations. The goal of creating a GPU-parallelized version of TopFitter was accomplished, achieving a 3.5x speedup. However, an unidentified bug remains when running on the largest dataset. As a side project, analysis found that interference prevents detection of non-Standard Model effects from events with non-standard color flows, implying a different approach is needed.
Using Monte Carlo Simulation in Project Estimates by Akram Najjar
The PMI Lebanon is glad to announce that Akram Najjar is the speaker for the a lecture titled “Using Monte Carlo Simulation in Project Estimates” delivered on Thursday, 28 July 2016
Lecture Outline
* Why are single point estimates unreliable and what is the alternative?
* What are distributions and how do we extract random samples from them (using Excel)? Two costing examples.
* How to setup a Monte Carlo Simulation model in a spreadsheet?
* Two PM examples (in detail)
* How to statistically analyze the thousands of runs to reach reliable estimates?
Lecture Objectives
* A Project Manager usually knows how certain parameters (such as duration, resource rates or quantities) behave. However, the PM can almost never define reliable single point estimates for these parameters. The result: many projects fail due to unreliable estimates. The alternative? The PM has to use his/her knowledge of how specific parameters behave statistically. For example, the PM knows that a specific task’s duration is distributed according to the bell shaped curve OR that another is uniformly distributed (flat variation), or triangular, or Beta-PERT, etc. The PM can then use Monte Carlo Simulation (MCS) to arrive at statistically significant and robust results. Monte Carlo Simulation (MCS) is a technique that relies on two processes. Process 1 aims at developing a spreadsheet model that calculates the critical path or the total cost, etc. The calculation is setup in a single row (or Run). This row is then duplicated a large number of times (thousands). Process 2 aims at inserting Excel functions in each of the parameters (durations, costs). In each row (or Run), such functions will provide a sample drawn from a statistical distribution that properly describes the behavior of that parameter. For example, a specific duration follows a Normal (Bell) distribution with an Average A and a Standard Deviation S. The model will then generate for each run and for that duration a different value that conforms with the bell shaped curve as defined (A and S). Each of these thousands of runs will provide the PM with a different “simulation” of the duration or the total cost, etc. By statistically analyzing the thousands of results, the PM can arrive at a robust and reliable estimate. Proprietary Add On’s for Monte Carlo Simulation in Microsoft Project are available. However, it is easy, free and more flexible to use native Microsoft functions to carry out the full simulation. The talk covered all the steps needed for such simulations giving several examples
This document presents the solutions to 4 optimization problems related to software engineering. The problems involve finding the optimal dimensions of boxes, cylindrical structures, and 3D models to minimize costs or pixel usage. Each problem is solved using calculus techniques like taking derivatives and finding critical points to determine maximum or minimum values. The conclusions emphasize how optimization problems are directly applied calculus to calculate extremes of functions subject to conditions.
Application of thermal error in machine tools based on Dynamic Bayesian NetworkIJRES Journal
In recent years, the growing interest toward complex manufacturing on machine tools and the
machining accuracy have solicited new efforts in the area of modeling and analysis of machine tools machining
errors. Therefore, the mathematical model study on the relationship between temperature field and thermal error
is the core content, which can improve the precision of parts processing and the thermal stability, also predict
and compensate machining errors of CNC machine tools. It is critical to obtain the thermal errors of a precision
machine tools in real-time. In this paper, based on Dynamic Bayesian Network (DBN), a pioneering modeling
method applied in thermal error research is presented. The dependence of thermal error and temperature field is
clearly described by graph theory, and the fuzzy classification method is proposed to reduce the computational
complexity, then forming a new method for thermal error modeling of machine tools.
1. The document describes steps to create agro-climatic zones of Tanzania using GIS by analyzing temperature, rainfall, and evapotranspiration data.
2. Key steps include converting vector data to raster, calculating moisture availability, classifying temperature and moisture zones, and combining the zones to produce the final agro-climatic map.
3. Models are created in GIS software to automate the process and allow easy reproduction of the analysis.
This document discusses the finite element method (FEM) for solving partial differential equations and boundary value problems. It provides an overview of the basic steps in FEM, including establishing the weak formulation, discretizing the domain, selecting shape functions, assembling the global stiffness matrix, applying boundary conditions, and solving the system of equations. The document also describes a Matlab FE program that will be used in the course, including the main files and plotting functions. Exercises are provided to test running the program and making advanced plots using figure and axis handles.
This lab report describes a program that creates acceleration profiles based on user input from two buttons. The program initializes registers, runs a debouncer routine to check for button presses, indicates the button pressed with LED lights, and passes a value to create the acceleration profile. Debugging was required to address issues with delays, LED/button implementation, memory access, and ensuring the program functioned as intended. In the end, the program successfully generated the expected acceleration profiles based on button input.
The document provides an overview and tutorial of the MathCAD software program. It discusses (1) what MathCAD is and its main functions, (2) how to open and navigate the MathCAD interface and toolbars, and (3) examples of how to enter equations, plot graphs, and perform calculations in MathCAD. The tutorial aims to explain the basic concepts and features of MathCAD to help readers learn how to use it to solve engineering and mathematics problems.
Smith waterman algorithm parallelizationMário Almeida
This document describes research on parallelizing the Smith-Waterman algorithm for sequence alignment using MPI. Two parallelization techniques are discussed: blocking and blocking with interleaving. Performance models are developed for each technique on linear and 2D torus network topologies. Optimal values for the blocking factor B and interleaving factor I are also derived from the models. The researchers implemented the techniques in C++ and tested performance using different values for B and I.
This document summarizes Matthew Weingarten's senior project on enhancing the UNIX-Based Image Manipulation Library (UIA). Weingarten added new functionality to UIA, most notably implementing the Walsh-Hadamard transform. He also improved documentation, updated deprecated code, and added error checking. Testing showed his Walsh-Hadamard transform implementation matched the output of MATLAB's implementation with zero error. Weingarten concluded the project expanded opportunities for image analysis in UIA and learned about image manipulation, command line use, documentation, and working with large datasets.
This document discusses curve fitting in Matlab. It introduces the Curve Fitting tool and how to use it to fit data to functions. Key aspects covered include importing data into the tool, selecting fitting functions, viewing and analyzing fit results, and plotting residuals. Examples are provided of fitting data to a sine wave, linear function with and without weights, and examining fit confidence bounds and predictions over different ranges. The document provides a tutorial on using Matlab's Curve Fitting tool to model experimental data with functions.
The document discusses several algorithms:
1. Program verification - A technique to mathematically prove that a program's output matches its specifications for any input.
2. Algorithm efficiency - Designing algorithms that are economical with resources like time and memory.
3. Analysis of algorithms - Qualities like correctness, understandability and efficiency.
It then provides examples of algorithms for:
1. Swapping variable values
2. Counting elements that meet a condition in a set
3. Summing a set of numbers
4. Computing factorials
5. Evaluating trigonometric functions like sine
Star Transformation, 12c Adaptive Bitmap Pruning and In-Memory optionFranck Pachot
Besides adaptive joins and adaptive parallel distribution, 12c comes with Adaptive Bitmap Pruning. I’ll describe the case it applies to and which is often not well known: the Star Transformation
Algorithm for computational problematic sitSaurabh846965
A computer requires precise instructions from a user in order to perform tasks correctly. It has no inherent intelligence or ability to solve problems on its own. For a computer to solve a problem, a programmer must break the problem down into a series of simple steps and write program code that provides those step-by-step instructions in a language the computer can understand. This process involves understanding the problem, analyzing it, developing a solution algorithm, and coding the algorithm so the computer can execute it. Flowcharts can help visualize algorithms and problem-solving logic in a graphical format before writing program code.
The document discusses linear programming models and optimization techniques. It covers sensitivity analysis and duality analysis to determine parameter values where a linear programming solution remains valid. It also discusses solving linear programming problems with integer constraints and using network models to solve transportation problems. The document then provides an example of using the simplex method and sensitivity analysis to solve a linear programming problem to maximize profit based on production capacity constraints.
This document provides steps to transfer operational data from an ECS system to Excel for analysis and visualization. Key steps include:
1) Using the ECS interface to select parameters and timeframe for trend data capture.
2) Copying the trend data to the clipboard and pasting into an Excel sheet.
3) Formatting the pasted data into separate columns for analysis and plotting.
4) Creating scatter plots of variables over time and interpreting relationships.
Similar to Robert_Tanner_Temperature_Distribution (20)
This document outlines Robert Tanner's research project on fracturing of brittle lattice structures under his supervisor Professor Martyn Pavier. The aims are to conduct a literature review on fracturing of brittle lattices, design experiments to demonstrate brittle fracture in solid and lattice structures, perform the experiments, and determine if fracture mechanics can predict failure of a brittle material containing a large lattice structure with cracks. The experiments will use PMMA test specimens with a lattice structure and crack-hole geometries cut using a waterjet cutter. Results and conclusions will analyze whether fracture mechanics can accurately model failure observations and identify potential discrepancies between theory and experiments.
The document reports on a project to determine the validity of using fracture mechanics to predict failure in lattice structures. Lattices with two and four circular unit cells were cut from PMMA and cracks of varying lengths and configurations were introduced. The lattices were loaded in tension and cracks were observed to see if they propagated as predicted. Material properties of PMMA were measured. Critical crack lengths and loads were measured and used to build finite element models to estimate stress intensity factors, which were compared to PMMA's fracture toughness. The stress intensity factors of the cracks were found to be close to or below the fracture toughness, indicating fracture mechanics may not fully predict failure of large lattices.
Robert Tanner completed his third year of a mechanical engineering degree. He passed all of his units, with marks ranging from 42 to 100 out of various maximum scores. His third year assessment contributed 40% to his degree mark, which he achieved with a mark of 73. He passed his year and will progress to the fourth year of his degree program.
The finite element analysis determined the suitability of a titanium panel to replace the floor of a rescue helicopter. Three mission scenarios were modeled: 1) with a 100kg winch attached and the panel built-in, 2) with the winch attached and the panel simply supported, and 3) with distributed 10kg grain sacks and the panel built-in. Finite element models were generated and found to accurately predict stress and deflection, matching analytical calculations. The models determined that scenario 1 and 2 posed no yield risk, and the helicopter could safely carry at least 250 grain sacks in scenario 3.
The document outlines the steps to simulate the motion of an electric motor:
1) Import motor and gearbox data and calculate initial parameters.
2) Set initial conditions and start the simulation.
3) Calculate torque and acceleration at each time step and update position and velocity.
4) Check termination conditions and exit or continue to the next time step.
Robert Tanner completed his second year of a Mechanical Engineering degree, passing all units. His performance was assessed as part of his second year, contributing 10% to his degree mark of 68%. He will progress to the third year of his program. The transcript provides unit titles, credit values, ranking of marks within each unit, and pass/fail results for each unit taken in the 2014-2015 academic year.
Robert Tanner completed a year-long industry placement at Dstl Security Sciences from September 24, 2013 to September 6, 2014. During this time, he engaged in various technical tasks including data analysis, technical drawing, electronics manufacturing, procurement, testing equipment evaluation, bench tests and trials, and editing technical documents. Some of his achievements included building and testing 25 antenna simulators, designing a bench-testable receiver, contributing to a technical datasheet, and wiring USB cables for use in trials. He also improved his skills in areas like Matlab, technical drawing, soldering, and professional conduct within a workplace.
2. Contents
1 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3 Script Development . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3.1 GUI Design . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3.2 Correcting Temperature Values . . . . . . . . . . . . . . . 4
3.3 Temperatures in the Hole . . . . . . . . . . . . . . . . . . 6
4 Completed Script . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
5 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6 Future Developments . . . . . . . . . . . . . . . . . . . . . . . . . 18
1 Summary
Designing this GUI was extremely challenging, and one of the most difficult
projects I did this year. The project s[ecification was to design a GUI that
would model the distribution of temperature across a plate in accordance with
Laplace’s equation, in an iterative process where the temperature at every arbi-
trary point on the plate was corrected to the mean of the four points immediatly
adjacent to it. The data used could either be a dataset specified by the user
or a default set. The code grew from the a program that used the default set
and allowed the user to only specify the spacing between the points and preci-
sion of the iterations to a full-fledged GUI that allowed the userr to change any
value and produce a series of charts to model this data. Designing a method to
correct the temperatures to the mean of the surrounding values in accordance
with Laplace’s equation was a diffcult puzzle that I eventually solved through a
series of complex matrix operations, in a method that produced corrected tem-
peratures quickly and efficiently, but only through a systematic series of lengthy
matrix operations. I also encountered a significant challenge in attempting to
code the behavior of the hole filled with conducting liquid in the centre of the
plate that is fixed at a temperature the average of all points around it, as it re-
peatedly encountered NaN errors and would not outpu any useful values. Both
these problems were resolved however, and I was able to program a GUI that
allows the user to input important variables, whether of their own choosing or
a default case, and produce a set of clear and informative graphs that modelled
the temperature distribution. Ultimately this resulted in a code that was an ef-
fective tool for the purpose it was designed, but could potentially receive further
development to increase user friendliness, aesthetics or allow the comparison of
several data sets in quick succession.
1
3. 2 Introduction
The purpose of this project was to write a MATLAB script that would model
the temperature distribution across a plate that was heated to a constant tem-
perature in the upper left corner and cooled to a constant temperature in the
bottom right, and had a hole containing a conductive liquid that ensured all
points in the hole are equal to the average of the temperatures surrounding the
hole. The script must therefore first define a matrix that represents the temper-
atures across the plate, estimate the initial temperatures of all the points on the
plate, and from that carry out an interative process to calculate each corrected
temperature, repeating the process until the error of the iteration drops below
a set level. The corrected temperature of each point is the average of the points
surrounding it on the plate. The project specified that the program must make
it possible to change every significant variable of the model, but also allow for
a default case, with the plate measuring 0.6 by 0.4 metres and a spacing of 0.01
metres between each point, heated to 100 degrees Kelvin 0.2 metres along the
upper left corner and cooled to 0 degrees Kelvin 0.1 metres along the bottom
right, the hole measuring 0.3 by 0.1 metres, the upper left corner of the hole
being situated 0.2 metres horizontally and vertically from the upper left of the
plate. The default iteration error level is 0.01. Therefore, I created a script
based on the special case defined in the brief, and then altered it into a more
general format, and created a GUI to act as a control panel for data input, with
the option of using a default dataset. The development cycle of the project is
given in the following section of this report.
3 Script Development
3.1 GUI Design
In designing the GUI itself I decided to forgo using Guide, therefore my project
is entirely programmatic, and I therefore took a great deal of information from
the Simple Programmatic GUI guide.[1] I felt a greater degree of control over the
program by coding everything myself, and I feared that I would not be able to
correctly use the uicontrol code proided by Guide. In retrospect I probably only
succeded in making work for myself, but I did gain a greater understandign and
appreciation of MATLAB. Initially, I set all values except the precision error
and spacing to the default values in the code and allowed the user to change the
value of both in the command line, using the same format as my first coding
project, the transmitted power of a pulley. All other values were defined in the
code in the appropriate point. The first two lines of code were therefore:
dx=input(’Input the desired spacing of points on the plate, in metres:’);
e=input(’Input the desired precision of the iterations:’);
I then coded a simple control panel GUI that allowed the user to change the
values of the spacing and precision through sliders, that worked between the
values of 0 and 0.1 metres in steps of 0.01 metres. I then changed the code to a
general case and added sliders for all variables, at this point a user had to close
the control panel after inputting the data, which created a filled contour plot.
I then learned how to code edit text boxes from the GUI Building guide.[2]
2
4. Figure 1: GUI Control Panel (sliders)
After doing so I replaced the sliders with edit boxes and added the ”Plot”
button, which automatically closes the control panel and activates the results
figures. I attempted to add axes to the control panel but the data would not
plot on the axes I defined in the figure.
3
5. Figure 2: GUI Control Panel (sliders)
3.2 Correcting Temperature Values
The main body of the program must define a matrix to contain the data cor-
responding to the temperatures across the plate, and then put that matrix
throgh an iterative process to find the corrected values. Defining the matrix
and special areas such as the plates and hole was fairly easy, since the coding
technique necessary to do so was given in the project specification. The main
problem was how to correct the temperatures in the matrix. I eventually de-
vised a method that is inelegant from a coding standpoint, but nonetheless
effective, when I looked at it as a matrix function and not a coding prob-
lem. I realised it was necessary to add the columns to the left and right
to each individual column, and to do the same with the rows. To explain
in more detail, it would be best to use an example; a simple 4 × 4 matrix.
M1 =
1 2 3 1
4 0 5 1
6 7 9 1
1 1 1 1
Let us consider only the value of point (2,2) on the matrixl which is 0.
According to the theory of the model, the corrected value will be equal to:
(2 + 4 + 5 + 7) ÷ 4 = 4.5 (1)
We must carry out a series of matrix operators. First, define a matrix that
contains the third column and any columns to the right of it, with the last two
columns being composed of zeroes, this has the effect of shifting the matrix two
spaces to the right.
M2 =
3 1 0 0
5 1 0 0
9 1 0 0
1 1 0 0
Then we add this new matrix to the original, and remove the last two
columns.
4
6. M3 =
4 3
9 1
15 8
2 2
This has the effect of adding adjacent columns together, the first column of
this matrix is the sum of the first and third columns of the original, and the
second column of this new matrix is the sum of the second and fourth columns
of the original. Then we repeat the process but with rows, taking the lowertwo
rows and moving them to the top of an empty 4 × 4 matrix, adding it to the
original and then removing the lower two rows, we find a new matrix where each
row is the sum of the row above and below it.
M4 =
7 9 12 2
5 1 6 2
These matrices do not have the same dimensions, but by removing the first
and last rows from the M3, and the first and last columns of M4, we find two
2 × 2 matrices that add to form:
M5 =
18 13
16 14
Divide each value by four, and you have a matrix that gives the corrected
values of the central four values in the matrix, if this matrix is used to replace
the centre of the original matrix, this has the effect of replacting every value
that is not part of the border of the matrix with it’s corrected value.
M6 =
1 2 3 1
4 4.5 3.25 1
6 4 3.5 1
1 1 1 1
The other values can be verified by inspection. This method is particularly
appropriate because it does not affect the values on the border of the matrix,
some of which are constants (the plates). In my program this method is used
to correct the values of the temperatures, they are then placed back into the
temperature matrix and the temperature of the walls and hole are altered ac-
cording to the demands of the problem. For example, a 1:10 scale of the default
model is transformed from:
temp old =
100.0000 100.0000 100.0000 50.0000 50.0000 25.0000 25.0000
100.0000 75.0000 75.0000 50.0000 50.0000 25.0000 25.0000
100.0000 75.0000 34.6875 34.6875 34.6875 34.6875 25.0000
50.0000 50.0000 34.6875 34.6875 34.6875 34.6875 0.0000
50.0000 50.0000 50.0000 25.0000 25.0000 0.0000 0.0000
into:
temp new =
100.0000 100.0000 100.0000 52.4219 39.9219 33.6719 25.0000
100.0000 87.5000 64.9219 52.4219 39.9219 33.6719 33.6719
100.0000 64.9219 37.0508 37.0508 37.0508 37.0508 29.8438
52.4219 52.4219 37.0508 37.0508 37.0508 37.0508 0.0000
50.0000 52.4219 42.3438 32.2656 32.2656 0.0000 0.0000
The low resolution of this matrix means it is slightly misleading, for instance
the corner values and some wall values seem inconsisent with the rules laid out
in the specification. It is important to note that these single points represent
what would be a large part of the array in the actual default case, but it does
serve as a moderately effective visual aid to the process.
5
7. 3.3 Temperatures in the Hole
The toughest technical challenge in designing this GUI was averaging the tem-
perature across the hole. Defining the section of the matrix that corresponds
to the hole was relatively easy. I first defined it for the default case as the area
between x arr=0.2 and 0.5, and between y arr=0.2 and 0.3, and after that was
able to convert it to the general case pretty easily. The code is designed to
convert the rows or columns of the matrix bordering the hole into vectors and
take an average of all the temperature values in these vectors, and then set the
temperature of the hole to that value. While using the default case, I noticed
that the vector ”l” which corresponds to the row immediately below the hole
was an empty vector. This resulted in the temperature of the hole being set to
a ”NaN” and a large area of the contour plot becoming white space, as shown
in Figure 3. For some reason, the code could not read the values of the matrix
between y arr=0.3 and 0.35. The problem seemingly fluctuated between lab
sessions- sometimes it would happen and sometime it would not, following the
conversion to the general case the problem seems to have disappeared, but I do
not know how or why.
Figure 3: Contour Plot due to NaN Error
6
8. 4 Completed Script
The basic operation of the script is that the user uses the control panel GUI
to enter the data into the script, then press the button marked ”Enter Data”,
shown below in Figure , or alternatively simply press the ”Default Data” but-
ton, thereby loading the default dataset. Pressing the ”Plot” button. Figure
shows the control panel with the appropriate data input needed to produce the
standard contour plot as defined in the project description, this closes the con-
trol panel and creates three additional Figures: a filled contour plot showing a
2D representation of the data, a mesh plot showing a 3D representation and a
text panel that gives the significant data of the model, as well as the number
of iterations required to complete the model. The colour axis of both graphs
is fixed with a maximum of 100 Kelvin and a minimum of 0 Kelvin, allowing
different datasets to be easily compared and instantly recognise the differences.
A step-by-step walkthrough of the code is shown below:
function the_answer=heat_distribution(dx,e)
% define control panel
f1=figure(’Position’,[500,200,1050,600],’Name’,’Control Panel’);
hdx=uicontrol(f1,’Style’,’edit’,’Position’,[800,300,100,50],
’callback’,{@spacing_Callback});
he=uicontrol(f1,’Style’,’edit’,’Position’,[800,200,100,50],
’callback’,{@precision_Callback});
hpw=uicontrol(f1,’Style’,’edit’,’Position’,[20,200,100,50],
’callback’,{@platewidth_Callback});
hpl=uicontrol(f1,’Style’,’edit’,’Position’,[20,300,100,50],
’callback’,{@platelength_Callback});
hhw=uicontrol(f1,’Style’,’edit’,’Position’,[20,400,100,50],
’callback’,{@holewidth_Callback});
hhl=uicontrol(f1,’Style’,’edit’,’Position’,[20,500,100,50],
’callback’,{@holelength_Callback});
hhx=uicontrol(f1,’Style’,’edit’,’Position’,[400,400,100,50],
’callback’,{@holexcoordinate_Callback});
hhy=uicontrol(f1,’Style’,’edit’,’Position’,[400,500,100,50],
’callback’,{@holeycoordinate_Callback});
htemp1=uicontrol(f1,’Style’,’edit’,’Position’,[400,300,100,50],
’callback’,{@heatedtemp_Callback});
htemp2=uicontrol(f1,’Style’,’edit’,’Position’,[400,200,100,50],
’callback’,{@cooledtemp_Callback});
htemp1d=uicontrol(f1,’Style’,’edit’,’Position’,[800,400,100,50],
’callback’,{@heateddimensions_Callback});
htemp2d=uicontrol(f1,’Style’,’edit’,’Position’,[800,500,100,50],
’callback’,{@cooleddimensions_Callback});
henter=uicontrol(f1,’Style’,’pushbutton’,’String’,’Enter Data’,
’Position’,[20,100,100,50]);
hdefault=uicontrol(f1,’Style’,’pushbutton’,’String’,’Default Data’,
’Position’,[900,100,100,50],’callback’,{@defaultbutton_Callback});
hplot=uicontrol(f1,’Style’,’pushbutton’,’String’,’Plot’,
’Position’,[420,100,100,50],’callback’,{@plotbutton_Callback});
7
9. st1=uicontrol(f1,’Style’,’text’,’String’,’Spacing
(default 0.01 metres)’,’Position’,[900,300,100,40]);
st2=uicontrol(f1,’Style’,’text’,’String’,’Iteration Precision
(default 0.01)’,’Position’,[900,200,100,40]);
st3=uicontrol(f1,’Style’,’text’,’String’,’Plate Width (default 0.6 metres)’,
’Position’,[120,200,100,40]);
st4=uicontrol(f1,’Style’,’text’,’String’,’Plate Height (default 0.4 metres)’
,’Position’,[120,300,100,40]);
st5=uicontrol(f1,’Style’,’text’,’String’,’Hole Width (default 0.3 metres)’,
’Position’,[120,400,100,40]);
st6=uicontrol(f1,’Style’,’text’,’String’,’Hole Height (default 0.1 metres)’,
’Position’,[120,500,100,40]);
st7=uicontrol(f1,’Style’,’text’,’String’,’Hole Horizontal Position
(default 0.2 metres)’,’Position’,[500,400,100,40]);
st8=uicontrol(f1,’Style’,’text’,’String’,’Heated Temperature
(default 100 Kelvin)’,’Position’,[500,300,100,40]);
st9=uicontrol(f1,’Style’,’text’,’String’,’Cooled Temperature
(default 0 Kelvin)’,’Position’,[500,200,100,40]);
st10=uicontrol(f1,’Style’,’text’,’String’,’Heated Plate Dimensions
(default 0.2 metres)’,’Position’,[900,400,100,40]);
st11=uicontrol(f1,’Style’,’text’,’String’,’Cooled Plate Dimensions
(default 0.1 metres)’,’Position’,[900,500,100,40]);
st12=uicontrol(f1,’Style’,’text’,’String’,’Hole Vertical Position
(default 0.2 metres)’,’Position’,[500,500,100,40]);
This section began the function, created the figure of the control panel (f1)
and defined the positions and sizes of the enter text boxes and attendant labels,
and the push buttons that allow the data to be entered and plotted
%input non-default data
waitfor (hdx,’value’)
function spacing_Callback(hdx,event)
dx=str2double(get(hdx,’string’));
end
waitfor (hpw,’value’)
function platewidth_Callback(hpw,event)
pw=str2double(get(hpw,’string’));
end
waitfor (hpl,’value’)
function platelength_Callback(hpl,event)
pl=str2double(get(hpl,’string’));
end
waitfor (htemp1,’value’)
function heatedtemp_Callback(htemp1,event)
temp1=str2double(get(htemp1,’string’));
end
8
10. waitfor (htemp1d,’value’)
function heateddimensions_Callback(htemp1d,event)
temp1d=str2double(get(htemp1d,’string’));
end
waitfor (htemp2,’value’)
function cooledtemp_Callback(htemp2,event)
temp2=str2double(get(htemp2,’string’));
end
waitfor (htemp2d,’value’)
function cooleddimensions_Callback(htemp2d,event)
temp2d=str2double(get(htemp2d,’string’));
end
waitfor (hhw,’value’)
function holewidth_Callback(hhw,event)
hw=str2double(get(hhw,’string’));
end
waitfor (hhl,’value’)
function holelength_Callback(hhl,event)
hl=str2double(get(hhl,’string’));
end
waitfor (hhx,’value’)
function holexcoordinate_Callback(hhx,event)
hx=str2double(get(hhx,’string’));
end
waitfor (hhy,’value’)
function holeycoordinate_Callback(hhy,event)
hy=str2double(get(hhy,’string’));
end
waitfor (he,’value’)
function precision_Callback(he,event)
e=str2double(get(he,’string’));
end
% define default dataset
function defaultbutton_Callback(hdefault,event)
dx=0.01;
e=0.01;
pw=0.6;
pl=0.4;
hw=0.3;
hl=0.1;
hx=0.2;
hy=0.2;
9
11. temp1=100;
temp2=0;
temp1d=0.2;
temp2d=0.1;
end
waitfor(henter,’ButtonDownFcn’)
This section codes the behavior of the edit boxes, the ”waitfor” preceding
each nested function ensures that the code waits for the value of the editbox
to change, after which the nested function extracts the value and the output of
each edit box is assigned a handle, corresponding to a variable in the model.
The control panel is designed so that each edit box is labelled appropriately and
indicates which variable it corresponds to. The ”waitfor” also ensures that the
latest value is used if the values are changed, and prevents NaN being entered for
any variable. It also codes the ”Default Data” button, it defines the default data
set and ensures it only activates if the ”Default Data” button is pressed. The
”waitfor(henter,’ButtonDownFcn’)” ensures that the variables are not enetered
unless the ”Enter Data” button is pressed.
%produce_matrix
format short
x=0:dx:pw;
y=0:dx:pl;
nx = length(x);
ny = length(y);
[x_arr, y_arr] = meshgrid(x, y);
temp = zeros(ny,nx);
% set heated points
heated_top = find((x_arr <= temp1d) & (y_arr == 0));
heated_left = find((x_arr == 0) & (y_arr <=temp1d));
heated_points=union(heated_top,heated_left);
temp(heated_points)=temp1;
%set cooled points
cooled_bottom=find((x_arr>=pw-temp2d)&(x_arr<=pw)&(y_arr==pl));
cooled_right=find((x_arr==pw)&(y_arr>=pl-temp2d));
cooled_points=union(cooled_bottom,cooled_right);
temp(cooled_points)=temp2;
This are of code begins to construct the matrix representing temperature,
creating an empty matrix of equal dimesnions to the plate and defining the
lengths and temperatures of the constantly heated and cooled regions. It does
this by using the variables pl (plate length), pw (plate width), dx (point spacing),
temp1 (constant hot temperature), temp2 (constant cold temperature), temp1d
(lengh of hot plate) and temp2d (length of cold plate). It is copied from or
extrapolates on the code given in the project specification for this purpose. [3]
temp3=0.5*(temp1+temp2);
10
13. jt=mean(j);
k=temp((x_arr==pw-dx)&(y_arr>=hy-hl)&(y_arr<=hy));
kt=mean(k);
l=temp((x_arr>=hx)&(x_arr<=hx+hw)&(y_arr>hy+hl)&(y_arr<=hy+hl+dx));
lt=mean(l);
h=(it+jt+kt+lt)/4;
temp(hole)=h;
This section completes the initial assumptions of the plate temperatures.
The first block of code define the temperatures of the walls as equal to the
temperatures of the points immediately adjacent to them in the plate proper,
with the temperature of the two corners that are not part of the heating plates
being defined as the temperature of the point immedately above (bottom left)
or below (top right) them on the walls. The temperature of the hole was a
technical challenge, as previously mentioned, but has been mostly fixed, the
second block defines the points that make up the hole, and defines the rows or
columns bordering them. These four vectors: it, jt, kt and lt are all averaged,
the averages are averaged to a single number h, which is then given as the
temperature of the hole. Figure 4 is an example of what a contour plot using
this data would look like (default data).
Figure 4: Initial Temperature Contour Plot
12
15. n=temp1-temp2;
ite=0;
This section of the code averages the temperatures in the ”center” of the
plate, namely every area that is not the walls, the process by which the tem-
peratures were averaged has been explored in detail in the previous section.
After averaging the center, the handle of the matrix is changed to ”temp old”
in preparation for the interative process, and then the walls and hole have their
temperatures changed to accomodate their specific properties. It also defines
a new matrix, ”temp new”, also in preparation for the iterative process, and
also provides it with the heated and cooled plates. It defines n, the number of
contour lines in the final contour plot as the difference between the two tem-
peratures, and gives the initial value of ”ite” as zero. ”ite” is the number of
iterations before the difference at each iteration is less than the precision level.
while abs(temp_old(2,2)-((temp_old(2,1)+temp_old(2,3)+
temp_old(3,2)+temp_old(1,2))/4))>e;
ite=ite+1;
R=zeros(1,nx);
S=zeros(ny,1);
M=temp_old(:,3:nx);
N=[M S S];
T1=temp_old+N;
T1=T1(:,1:nx-2);
T1=T1(2:ny-1,:);
O=temp_old(3:ny,:);
P=[O;R;R];
T2=temp_old+P;
T2=T2(1:ny-2,:);
T2=T2(:,2:nx-1);
T=(T1+T2)/4;
centre=find((x_arr>0)&(x_arr<pw)&(y_arr>0)&(y_arr<pl));
temp_new(centre)=T;
heated_top = find((x_arr <= temp1d) & (y_arr == 0));
heated_left = find((x_arr == 0) & (y_arr <=temp1d));
heated_points=union(heated_top,heated_left);
temp_new(heated_points)=temp1;
cooled_bottom=find((x_arr>=pw-temp2d)&(x_arr<=pw)&(y_arr==pl));
cooled_right=find((x_arr==pw)&(y_arr>=pl-temp2d));
cooled_points=union(cooled_bottom,cooled_right);
temp_new(cooled_points)=temp2;
left_wall=find((x_arr==0)&(y_arr>temp1d)&(y_arr<pl));
temp_new(left_wall)=temp((x_arr==dx)&(y_arr>temp1d)&(y_arr<pl));
temp_new((x_arr==0)&(y_arr==pl))=temp((x_arr==0)&(y_arr==pl-dx));
right_wall=find((x_arr==pw)&(y_arr<pl-temp2d)&(y_arr>=dx));
temp_new(right_wall)=temp((x_arr==pw-dx)&(y_arr<pl-temp2d)&(y_arr>=dx));
temp_new((x_arr==0.6)&(y_arr==0))=temp((x_arr==pw)&(y_arr==dx));
floor=find((x_arr>0)&(x_arr<pw-temp2d)&(y_arr==pl));
14
17. Figure 5: Unmanipulated Temperature Contour Plot
function plotbutton_Callback(hplot,event)
close(f1)
end
f2=figure(’Position’,[0,100,1000,800],’Name’,’Contour Plot’);
ha=axes(’Units’,’Pixels’);
contourf(ha,Z,n);
caxis([0 100]);
colorbar;
axis off;
f3=figure(’Position’,[950,500,500,500],’Name’,’Important Data’);
st13=uicontrol(f3,’Style’,’text’,’String’,[’Spacing between adjacent points is ’,
num2str(dx),’ metres’],’Position’,[50 25 400 50],’FontSize’,12,’FontWeight’,’bold’);
st14=uicontrol(f3,’Style’,’text’,’String’,[’Iteration precision (error level) is ’,
num2str(e)],’Position’,[50 75 400 50],’FontSize’,12,’FontWeight’,’bold’);
st15=uicontrol(f3,’Style’,’text’,’String’,[’Plate dimensions are ’,num2str(pw),’ x ’,
num2str(pl),’ metres’],’Position’,[50 125 400 50],’FontSize’,12,’FontWeight’,’bold’);
st16=uicontrol(f3,’Style’,’text’,’String’,[’Hole dimensions are ’,num2str(hw),’ x ’,
num2str(hl),’ metres’],’Position’,[50 175 400 50],’FontSize’,12,’FontWeight’,’bold’);
st17=uicontrol(f3,’Style’,’text’,’String’,[’The top left corner of the hole is ’,
num2str(hx),’ to the right and ’,num2str(hy),’ metres below the top left corner of the pla
16
18. st18=uicontrol(f3,’Style’,’text’,’String’,[’The temperatures range from ’,num2str(temp2),’
num2str(temp1),’ degrees Kelvin’],’Position’,[50 275 400 50],’FontSize’,12,’FontWeight’,’b
st19=uicontrol(f3,’Style’,’text’,’String’,[’The heated plate measures ’,num2str(temp1d),
’ metres to a side’],’Position’,[50 325 400 50],’FontSize’,12,’FontWeight’,’bold’);
st20=uicontrol(f3,’Style’,’text’,’String’,[’The cooled plate measures ’,num2str(temp2d),,’
st21=uicontrol(f3,’Style’,’text’,’String’,[’The process is completed in ’,num2str(ite),
’ iterations’],’Position’,[50 425 400 50],’FontSize’,12,’FontWeight’,’bold’);
f4=figure(’Position’,[1400,100,500,500],’Name’,’Mesh Plot’);
graphwidth=(pw/dx)+1;
graphlength=(pl/dx)+1;
mesh(Z);
axis([1 graphwidth 1 graphlength]);
caxis([0 100]);
colorbar;
end
Finally, pressing the ”Plot” button on the control panel closes it, creating
three new Figures: a filled contour plot, a text window detailing the variables
of the model and a mesh plot showing a 3D representation of the data. The
axes of the meshplot are defined as the number of points that make up the x or
y axis, calculated as the plate dimenosions divided by the spacing and with an
additional , as to prevent unwanted white space. The process is now complete.
Figure 6: Results of Program
Although I feel the code has been completed to a competent standard, there
are changes and additions that I would have made, and would like to make at
some point in the future, if I had more time and greater programming skill,
those are laid out in the next two sections.
17
19. 5 Discussion
I believe that my code was completed to a satisfactory standard and fulfils the
project specification, allowing a user to model the distribution of temperature
across a plate, using either a default case or values of their own choosing for
the important variables. However, I recognise that it could still be improved.
The scope is limited and does not allow for quick changes of the data. It
should also be noted that if the spacing between the points on the plate is
small in comparison to the dimensions of the plate, then the code takes a great
deal of time to complete and may possibly suffer an NaN error, but this is
rare. I could not find a way to cause the graph to output to an axes on the
control panel, meaning it is necessary to close the control panel and restart
the program if you wish to compare two separate data sets. The method of
correcting the temperature values is effective and relatively quick if the spacing
and iteration precision of the data is not very small in comparison to the other
values, but is not the most elegant solution from a coding standpoint, and relies
on brute-forcing the mathematics rather than correcting each value one by one,
such as in a Kernel program. The charts are clear, aesthetically pleasing and
informative, and use a broad range of the capabilities of MATLAB, displaying
the data graphically and verbally. In short, the finished project is competently
made, and a useful tool, but it is not perfect and there is still room for further
developments.
6 Future Developments
I would like to add some animation to the GUI, to improve user friendliness and
aesthetic appeal to the user, ideally I would like to show how the contour lines
move and change as the model becomes increasingly close to reality. A small
change that would prevent NaN errors would be to cause the GUI to reject any
values of spacing lower than the values for the shortest plate dimension by a
factor of 100. Another possible addition to the project that I did not have time
to develop, as the idea only occured shortly before the deadline, would be a
single scatter graph to show how the temperature varies along a diagonal line
across the plate from the upper left to bottom right corners. Finally, I would
have liked to have included the graphs on the control panel, which change with
the data, allowing quick and easy comparison of myriad data sets, but ultimately
this was a coding puzzle that I could not solve.
[1] [2] [3]
18
20. Bibliography
[1] MATLAB Help. About the simple programmatic gui, 2012.
[2] MATLAB Help. Gui building/component selection/gui controls and indica-
tors/uicontrol, 2012.
[3] Dr Andrew Lawrie. Computer-based modelling: Matlab projects, 2014.
19