WE WRITE CUSTOM ACADEMIC PAPERS

100% Original, Plagiarism Free, Tailored to your instructions

Order Now!

Least square fitting

Least square fitting
. Develop appropriate solutions to technological problems
. Describe and apply features of an objected-orientated programming language
. Eectively exploit the programming language and development environments
5.1 Least-squares fitting
In engineering applications we often have to fit a mathematical model to data, often experimental data that are
subject to measurement errors. This assignment is to do exactly that in one of the simplest cases – fitting a straight
line to a set of measurements that ought to lie on a straight line but that don’t quite do so because of measurement
errors.
This process is known as a least-squares fit, because of the algorithm used. The mathematics behind a linear
(straight line) least-squares fit are quite simple and are well known and widely documented. They are summarised
in a document: “An introduction to least-squares fitting”, available on Blackboard.
“An introduction. . . ” gives some simple examples and some references; in this assignment we shall concentrate
on determining the best equation
y = a + bx
that fits a data set such as that given in figure 1. In other words, for a given data set we have to determine
. Our best estimates of the parameters a (the “intercept”) and b (the “slope”).
. The estimated uncertainty in intercept and slope.
Least squares fitting is very powerful and very interesting, and is something about which every engineer should
know. Nonetheless, the purpose of this assignment is not to study the technique itself but to develop a useful
software application implementing algorithms provided (as pseudocode) in “An introduction. . . ”
5.2 Example data and GUI application
Figure 1 shows some example data suitable for a straight-line fit. These data are available on Blackboard (as file
data.txt) to support your testing your application. Your application will have to read data from a file such as this.
Note that the data come in x; y pairs, one to a line, separated by tab characters. Note also that the first line contains
Page 2 of 8
University of Central Lancashire
School of Computing, Engineering & Physical Sciences
EL2311 Coursework Assignment
xi yi
0 -3.347808
0.1 -2.594193
0.2 -1.930295
0.3 -0.647211
0.4 0.315137
0.5 1.543327
0.6 1.370375
0.7 3.110938
0.8 3.05416
0.9 4.061771
1 4.627437
1.1 5.933753
1.2 6.281999
1.3 6.421473
1.4 7.175764
1.5 7.668333
1.6 9.165742
1.7 10.055097
1.8 9.839108
1.9 10.441661
2 12.195463
2.1 12.758102
2.2 12.897014
2.3 12.906194
2.4 14.205887
2.5 15.644408
Figure 1: Example least-squares-fit data set
column headings, not data. This helps the human reader interpret the file; your software will also have to deal with
it and you have the challenge of achieving that.
Figure 2 is a screenshot of my model answer processing the data of figure 2.1 Your program should behave
similarly, although it is not necessary for it to mimic mine closely.
Observe that there is a graphical user interface with a facility for entering the file name as a text string. Your
program should also have a GUI, and must be capable of reading data from a file whose name is specified by the
user, not by the programmer.
There are textual and graphical displays, showing the data from the file. Your program should also display the
file contents as text and as a plot. The text display is – should be – easy; the plot will be trickier.
There are controls for quitting the application (of course), and for doing the fit. When the fit is done, the graph
is updated (slightly tricky) and parameter values and uncertainties are displayed (easier). Your program should
also behave similarly.
Of course, we have here a GUI class using Widgets from the SCAT graphics library. But there are also
additional classes and functions behind the scenes, to make it easier to read and fit the data. Your program should
also use object-orientated techniques to achieve similar results.
5.3 Assignment requirements
Your brief is to develop an application program to analyse data such as those in figure 1.
The application shall meet the following general requirements
1. Be written entirely in standard C++.
2. Be developed using Visual Studio 2010 and the SCAT toolset used in this module. (Any edition of Visual
Studio 2010 is acceptable; the deliverable will be in the form of a Visual Studio 2010 solution, and assess-
1 I see that I have used a dierent convention: m for slope and c for intercept. But it’s the same equation: y = mx + c.
Page 3 of 8
University of Central Lancashire
School of Computing, Engineering & Physical Sciences
EL2311 Coursework Assignment
Figure 2: Example least-squares-fit GUI
ment will include building and debugging using the Visual Studio 2010 Ultimate Edition on the UCLan
corporate Windows 7 network.)
A fully compliant application shall also meet the following specific requirements:
1. Have a graphical user interface, similar to that shown in figure 2.
2. Read the name of a text file containing data formatted (in x; y pairs) as in figure 1.
3. Read the data from the file.
4. Display the data as text.
5. Plot the data as points on a simple graph.
6. Determine and display the parameters of the best straight line fit to the data in the file, using the algorithm
provided in “An introduction. . . ”.
7. Determine and display the uncertainty in the least-squares fit parameters, using the algorithm provided in
“An introduction. . . ”.
8. Plot the best fit line on the same axes as the data points.
5.4 Additional guidance
I expect that all students will meet all the general requirements and at least some of the specific requirements.
Failure to meet all the specific requirements will not necessarily lead to mark below the pass mark for this assignment.
Page 4 of 8
University of Central Lancashire
School of Computing, Engineering & Physical Sciences
EL2311 Coursework Assignment
At the time of publishing this assignment we have already studied all the software development techniques
required to construct my model answer, except for the plot. The plotting is the most challenging part, partly
because the plotting capability of the libscat library is limited. Attempt it last.
Probably, the most useful order in which you should approach this development activity is as follows:
1. GUI design
2. File IO
3. Data display (text)
4. Fit calculation
5. Fit display (text)
6. Data display (plot)
7. Fit display (plot)
The checklist shown in Appendix C identifies the things I shall be looking for in your submissions and is
intended to help you check your progress and your achievement against the requirements. Please also submit a
copy (in pdf, in your zip file); it will form a useful self-evaluation and will help me find the evidence required to
evaluate your work.
My model answer has about 400 lines of source code (including white space and comments) in 7 files (*.cpp
and *.h).
A discussion forum for the assignment is available on Blackboard. Please ask questions there.
Page 5 of 8
University of Central Lancashire
School of Computing, Engineering & Physical Sciences
EL2311 Coursework Assignment
A Grade scale
Develop appropriate
solutions to technological
problems
Describe and apply
features of an objectorientated
programming
language
Eectively exploit the
programming language
and development environments
Eectively apply software
design and development
principles
Correct and ecient
operation meeting all
specified requirements
with robust error handling
throughout, even in
pathological cases.
Sophisticated application
of object-orientated programming
features as appropriate
to the specific
requirements.
Near-optimum selection
of features from the programming
language and
supporting libraries.
Application of suitable
standard algorithms, going
beyond material explicitly
covered in class.
Full and reliable implementation
of specified
requirements, including
an eective graphical
user interface.
Proper management of
invariants and of system
resources, especially
memory. Eective use of
abstract and concrete
classes, and of polymorphism.
Comprehensive use of
language and library features
including some use
of features beyond the
examples demonstrated
in class. Accomplished
use of automatic code
documentation.
Eective error handling,
including the use of assertions
and exceptions.
Selection and application
of suitable additional test
sets.
Reliable operation with
no significant errors in
most or all use cases.
Eective design of a user
interface and of event
handlers.
Eective design of
classes, including at
least one derived class,
accounting for the principles
of encapsulation
and inheritance.
Comprehensive use of
stream IO. Eective use
of features from at least
one non-standard library.
Use of automatic code
documentation.
Eective use of defensive
programming principles
to ensure reliability.
Suitable choice and
eective use of parameter
passing paradigms.
Eective use of source
code comments.
Successful compilation
without warnings.
Correct execution of at
least a baseline feature
set.
Correct selection and use
of library classes and
objects.
Correct use of standard
containers or other aggregate
data structures.
Suitable partitioning
of source code. Wellchosen
function designs.
Adequate use of source
code comments.
Successful compilation
and execution in at least
some use cases.
Valid creation and use of
at least one class type.
Successful stream and
file IO, and successful
selection and use of built
in data types and operators
and standard library
functions
Proper use of postcondition
checks where
needed. Appropriate
source code layout and
naming. Correct function
implementation.
Unsuccessful compilation
or inability to execute
without significant errors
occurring in most or all
use cases.
No use or incorrect use
of user-defined data
types.
Significant errors in the
use of features from the
language, libraries or development
environment.
Little or no evidence of
application of software
design principles.
Failure to comprehend
or address the learning
outcome.
Failure to comprehend
or address the learning
outcome.
Failure to comprehend
or address the learning
outcome.
Failure to comprehend
or address the learning
outcome.
80 80
70 70
60 60
50 50
40 40
30 30
Page 6 of 8
University of Central Lancashire
School of Computing, Engineering & Physical Sciences
EL2311 Coursework Assignment
B Extracts from Academic Regulations
Also see http://www.uclan.ac.uk/aqasu/academic_regulations.php.
B.1 Late submission
Academic regulations section G3 refers:
The University operates a universal penalty scale for unauthorised late submission of any form of
assessed work. Students who submit work within 5 working days after the published submission date
without an authorised extension will obtain a maximum of [40%] for that element of assessment. All
work submitted later than 5 days after the published submission date will be awarded a mark of 0%
for that element of assessment.
N.B.
. “5 days” means five days excluding weekdays, i.e. seven calendar days.
B.2 Unfair means to enhance performance
Academic regulations section G7 refers:
Unfair means includes all forms of cheating, plagiarism, collusion and re-presentation . . .
All instances or allegations of the use of unfair means will be investigated . . .
In the event of a single oence of cheating, plagiarism, collusion and re-presentation in an undergraduate
or postgraduate assessment, the appropriate penalty will be 0% for that element of assessment, and
an overall fail for the module . . . The plagiarised element of assessment must be resubmitted to the
required standard. The mark for the module following resubmission will be restricted to [40%] . . .
In the event of a repeat oence . . . on the same or any other module within the course, the appropriate
penalty will be 0% for the module with no opportunity for re-assessment.
N.B.
. When one student copies from another, with the other’s permission or even as a result of inadvertence on
the part of the second student, both students are liable to be penalised for collusion.
. “Re-presentation” (the hyphen is significant) means submitting the same work, or substantially the same
work, for more than one assessment.
Page 7 of 8
University of Central Lancashire
School of Computing, Engineering & Physical Sciences
EL2311 Coursework Assignment
C Submission checklist
EL2311 2013/14 assignment checklist Student:
Complete this checklist and submit it with your assignment to:
• Help you ensure that you have demonstrated the skills that the assignment is intended to assess
• Help you identify the evidence needed to give you the credit you deserve
Note:
• This is not a checklist for passing. You do not have to demonstrate all of these things to achieve a pass mark for this
assignment. But model answers, achieving full marks, ought to demonstrate most or all of the skills identified here
• If you don’t know the meaning of any of the terms given in the left-hand column, you should refer to the module
materials on Blackboard and to the recommended texts, especially Stroustrup’s “Programming Principles and Practice.”
What have you demonstrated? Where is the evidence? (File names, line numbers, etc.)
C++ standard library features
. Containers
. File stream IO
. String stream IO
. Mathematics
SCAT library features
. Graphics
. Widgets
Procedural programming
. Function design
. Pass by reference
. Pass by constant reference
Object-orientated programming
. Data type design
. Encapsulation
. Inheritance
. Resource management
Event-driven programming
. GUI design
. Callback implementation
Error handling
. Precondition checks
. Postcondition checks
. Invariants
. Throwing exceptions
. Catching exceptions
Code partitioning
. File naming
. File location
. File contents
. File inclusion
. Include guards
Code documentation
. Good program layout
. Effective naming
. Effective comments
. Doxygen-style comments
PLACE THIS ORDER OR A SIMILAR ORDER WITH US TODAY AND GET AN AMAZING DISCOUNT ?

Our Service Charter

  1. Excellent Quality / 100% Plagiarism-Free

    We employ a number of measures to ensure top quality essays. The papers go through a system of quality control prior to delivery. We run plagiarism checks on each paper to ensure that they will be 100% plagiarism-free. So, only clean copies hit customers’ emails. We also never resell the papers completed by our writers. So, once it is checked using a plagiarism checker, the paper will be unique. Speaking of the academic writing standards, we will stick to the assignment brief given by the customer and assign the perfect writer. By saying “the perfect writer” we mean the one having an academic degree in the customer’s study field and positive feedback from other customers.
  2. Free Revisions

    We keep the quality bar of all papers high. But in case you need some extra brilliance to the paper, here’s what to do. First of all, you can choose a top writer. It means that we will assign an expert with a degree in your subject. And secondly, you can rely on our editing services. Our editors will revise your papers, checking whether or not they comply with high standards of academic writing. In addition, editing entails adjusting content if it’s off the topic, adding more sources, refining the language style, and making sure the referencing style is followed.
  3. Confidentiality / 100% No Disclosure

    We make sure that clients’ personal data remains confidential and is not exploited for any purposes beyond those related to our services. We only ask you to provide us with the information that is required to produce the paper according to your writing needs. Please note that the payment info is protected as well. Feel free to refer to the support team for more information about our payment methods. The fact that you used our service is kept secret due to the advanced security standards. So, you can be sure that no one will find out that you got a paper from our writing service.
  4. Money Back Guarantee

    If the writer doesn’t address all the questions on your assignment brief or the delivered paper appears to be off the topic, you can ask for a refund. Or, if it is applicable, you can opt in for free revision within 14-30 days, depending on your paper’s length. The revision or refund request should be sent within 14 days after delivery. The customer gets 100% money-back in case they haven't downloaded the paper. All approved refunds will be returned to the customer’s credit card or Bonus Balance in a form of store credit. Take a note that we will send an extra compensation if the customers goes with a store credit.
  5. 24/7 Customer Support

    We have a support team working 24/7 ready to give your issue concerning the order their immediate attention. If you have any questions about the ordering process, communication with the writer, payment options, feel free to join live chat. Be sure to get a fast response. They can also give you the exact price quote, taking into account the timing, desired academic level of the paper, and the number of pages.

Excellent Quality
Zero Plagiarism
Expert Writers

Instant Quote

Subject:
Type:
Pages/Words:
Single spaced
approx 275 words per page
Urgency (Less urgent, less costly):
Level:
Currency:
Total Cost: NaN

Get 10% Off on your 1st order!