Labreport Guide
Labreport Guide
Group 00
Student 70000
Student 70001
Student 70002
January 1, 1970
2 Problem Description 3
2.1 Illustrations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
5 Conclusion 11
Appendix 12
A MATLAB Code 12
A.1 plot_constraint.m . . . . . . . . . . . . . . . . . . . . . . . . 12
B Simulink Diagrams 12
B.1 A Simulink Diagram . . . . . . . . . . . . . . . . . . . . . . . 12
References 14
1 Introduction
Your introduction should contain an overview of the work you were assigned,
as well as a few sentences putting the work into a larger perspective. You
should also give a quick description of how the report is organized (as is done
below).
You should of course put most of the work into doing good work in the
lab and then presenting it in the report. When presenting your work in the
report, both content and presentation/layout matters. Since your only way
of communicating your good effort in the lab is through writing about it
here, the way you write about it is essential. This means that even if you
have the very best controller but describe it poorly, you will probably not be
rewarded for the good results. A plot showing perfect control is worth very
little if it is not accompanied by a clear description of what it represents.
Layout is naturally less important than content, but it still matters.
You can think of report writing like selling an apartment; when you present
your apartment for potential buyers you will of course clean the apartment
and make it good looking. How clean the apartment is does of course not
determine its value, but it is still important since it influences the subjective
value your buyers will put on the apartment.
1.1 Software
You are of course free to use whatever software you want for report writing.
You can also submit a handwritten report, although this is probably not a
great idea if your handwriting can be hard to read.
You can also use Word or a similar word processor. However, it is next
to impossible to achieve decent layout with Word. The support for vector
graphics (discussed later) is extremely poor, and text tends to look pretty
bad (bad support for kerning and ligatures). Furthermore, math is both time
consuming and difficult to input, and tends to look very ugly. In general, a
report written in Word looks like a draft.
It is strongly recommended to use Latex. Unless you tweak the layout
too much, your report will almost certainly look very good. Although it
can take a bit of effort to get started, it is also much quicker to use than
Word and similar programs. The support for math and vector graphics is
also great.
If you are new to Latex, you can have a look at the source for this
document to get started. You can also look at the presentation by [1] (in
Norwegian) or consult [5]. Another good reason to learn Latex is that you
probably don’t want to write your master’s thesis in something like Word,
doing so would likely be very frustrating. Being reasonably fluent in Latex
before you get that far will make your thesis work much smoother.
Some of you are probably fluent in Latex and might plan to write the
1
report using it. Please resist the temptation (if any) to change the fonts,
make super fancy headers (they are not necessary for a report like this),
change the margins, change the paragraph indentation and/or spacing, and
similar things.
A great tool for collaborating on Latex documents is ShareLaTeX at
https://www.sharelatex.com/; if you use this you won’t have to install
anything on your computer. Texmaker at http://www.xm1math.net/texmaker/
is a good cross-platform editor. Some people like Lyx, which is a Latex edi-
tor that behaves a little bit like Word. If you prefer to compile your Latex
document on the command line, the latexmk https://www.ctan.org/pkg/
latexmk command is a great tool included in most TeX distributions. There
is also a simple Vim plugin that uses latexmk as its backend called LaTeX-
BoX https://github.com/LaTeX-Box-Team/LaTeX-Box.
2
2 Problem Description
You should have a section that describes the lab setup, including a model
of the helicopter. If you want, you can copy the source code for the model
equations:
Since these equations belong together, it’s a good idea to number them like
this:
You can then both reference individual equations (“the elevation equation
Equation (5a)”) or reference the entire model (“the linear model Equation (5)”).
Regardless of your choice of software, never hard-code a reference, always use
dynamic references.
You could also align the equations like this:
2.1 Illustrations
If you decide to include an illustration, that’s great. You can in general copy
figures and illustrations from the textbook, the assignement text, or other
places. However: ALWAYS CITE THE SOURCE. You can also draw your
own (cite the source if it is heavily based on someone else’s.). Figure 1 was
created quickly with Ipe (http://ipe.otfried.org/). Inkscape is a good
alternative for more advanced illustrations. Some people prefer the Latex
package TikZ (http://texample.net/tikz/examples/), but this takes a
little effort to learn.
3
Optimization layer Model-based optimization
u∗
4
Table 1: Parameters and values.
Symbol Parameter Value Unit
la Distance from elevation axis to helicopter body 0.63 m
lh Distance from pitch axis to motor 0.18 m
Kf Force constant motor 0.25 N/V
Je Moment of inertia for elevation 0.83 kg m2
Jt Moment of inertia for travel 0.83 kg m2
Jp Moment of inertia for pitch 0.034 kg m2
mh Mass of helicopter 1.05 kg
mw Balance weight 1.87 kg
mg Effective mass of the helicopter 0.05 kg
Kp Force to lift the helicopter from the ground 0.49 N
3.2 Tables
If you want, you can use the source for Table 1 to see how a (floating) table
is made.
Variables and symbols are always in italics, while units are not.
5
improves the readability of the tex files. For instance; maybe you want each
problem to start on a new page? Simply add \newpage before each \input{}
command. Alternatively, you can use the \include{} command to achieve
more or less the same effect. See [6] for more information.
1
Keep citation of web pages to a minimum, and consider using http://web.archive.
org if you are worried that the reference may change or be removed in the future.
6
4 Results and Figures
Answer all the parts of the exercise in an organized and clear manner. You
should of course try to get good results in all the exercises, but if you have
made a good effort without achieving great performance, a good discussion
of possible reasons is just as good. Present your thinking and efforts and
discuss possible reasons for good or bad results.
Include plots and/or tables of all relevant results, but make sure you don’t
overwhelm the reader with too many plots. Have a clear plan about what
you want to communicate with a specific plot/figure, and use appropriate
labels and comments. Keep in mind that the plots should be as “readable” as
possible; that is, they should not be too hard to interpret and be reasonably
self contained.
There are some important things to consider when exporting figures from
MATLAB, most importantly which format you use. Never ever use JPEG
for anything that is not a photography or similar. Any figure, like a plot or
block diagram, must never be stored as a JPEG. If you zoom in on Figure 2
you can see a lot of noise close to any of the dark curves and lines, this is due
to the compression in JPEG. Figure 2 will look horrible both on a screen
and on paper.
The PNG format is slightly better for plots, but since it is a raster format
(a grid of pixels), it looks ugly if you zoom in. It also looks ugly if you scale
it, both on a screen and on paper. Try to avoid PNG if you can. Figures 3
and 4 are both PNG figures; the latter being a larger figure scaled more than
the former. Note both how choppy and ugly the blue curve is, and how the
different sizes create inconsistent font sizes.
The simplest way to get a reasonably good looking plot is to save it as
EPS in MATLAB. Do this by clicking “File” in the figure window, and the
“Save As. . . ”; choose “EPS file (*.eps)” in the “Save as type:” menu.2 Figure 5
shows a plot in EPS format. Since EPS is a vector format, the Figure can be
scaled and still look good (but mind the font size!). If you zoom in you can
see that the curve and the letters/numbers are smooth. A figure in vector
format will usually look good both on a screen and on paper.
Note that the size of the actual figure window in MATLAB determines
how large the exported figure is. Hence, if you enlarge the figure window
before exporting, you will need to scale the figure by a larger factor in the
report. This will lead to a tiny font in the figure. There are many better
ways of exporting graphics from MATLAB, but they quickly become fairly
involved. The above method of exporting to EPS will in most cases give nice
figures.
You can write Latex in your MATLAB figures. The script used to create
2
pdfLatex does not support EPS directly, but since we have loaded the epstodf package,
this is not a problem.
7
Figures 2 and 5 is included in Appendix A.1. Do not use a screen shot of a
scope of figure in MATLAB in your report.
Remember to reference all figures in the text. Figures have a number and
should be referenced by that number (again, always use dynamic references).
They also tend to float around, meaning they generally don’t appear where
you ask them to in the text. This is fine, do not try to force a figure (or a
table) to appear in a particular place. As long a you refer to it, it’s easy to
find. No figure should be included without being referenced in the text.
If you look at the source code for including figures, you can see that
the optional option [htb] has been used. This tells Latex where you wish
the figure to appear, in prioritized order. h means “Here”, t means “Top
of this page”, b means “Bottom of this page”, and p (not used here) means
“on a Page with only floats (such as figures and tables)”. Note that your
wish might not be granted, and this is because Latex actually optimizes the
placement of figures. If you start forcing figures to be in specific places, it
often leads to really strange layout somewhere else in the document.
Generally, let Latex handle the documentation layout. This is one of the
main reasons to choose Latex over software such as Microsoft Word.
8
Figure 3: A plot in PNG format — a bad idea.
9
12
10
8
e/degrees
0
70 80 90 100 110 120 130 140 150 160 170
λ/degrees
10
5 Conclusion
This does not have to be long, but try to write a few reasonable closing
remarks.
11
A MATLAB Code
This section should contain your MATLAB code. DO NOT attach files
posted online (that you didn’t write). Note that the method used to input
code below does not look as pretty when the lines are too long.
A.1 plot_constraint.m
9 l_deg = l *180/ pi ;
10 e_deg = e *180/ pi ;
11
12 figure (1)
13 plot ( l_deg , e_deg , ’ LineWidth ’ , 2)
14
B Simulink Diagrams
This section should contain your Simulink diagrams. Just like the plots,
these should be in vector format, like in Figure 6. Make them tidy enough
to understand.
12
p_c optimal
[tidsvektor, u_mod ]
e_offset
-180
Terminator 2
p_c, rad
p, rad Out 2 V_d V_f V_f , motor foran Vandringsrate , (grader /sek )
Demux
Pitch , (grader )
p_dot , rad/sek
Mux
Pitchrate , (grader /sek )
Pitch -kontroller
Elevasjon , (grader )
V_s V_b V_b, motor bak
e, rad
Elevasjonsrate (grader /sek )
e_dot , rad/sek V_s
Demux Mux
V_d/V_s --> V_f/V_b Heli 3D
0*pi /180 e_c, rad
-30
Elevasjonskontroller
e_c lambda _offset elevasjon (grader )
D2R
Degrees to
Radians
13
References
[1] H Berland. En introduksjon til Latex. http : / / www . pvv . ntnu . no /
~berland/latex/latexintro4up.pdf. 2010.
[2] bibtex vs. biber and biblatex vs. natbib. http://tex.stackexchange.
com/questions/25701/bibtex-vs-biber-and-biblatex-vs-natbib.
Accessed: 2017-02-13.
[3] Chi-Tsong Chen. Linear System Theory and Design. Oxford University
Press, Incorporated, 2014.
[4] M. Downes. Short Math Guide for LATEX. ftp://ftp.ams.org/pub/
tex/doc/amsmath/short-math-guide.pdf. 2002.
[5] T. Oetiker et al. The Not So Short Introduction to LATEX 2e. http:
//tobi.oetiker.ch/lshort/lshort.pdf. 2011.
[6] When should I use input vs. include? http://tex.stackexchange.
com/questions/246/when- should- i- use- input- vs- include. Ac-
cessed: 2017-02-13.
[7] Wikibooks LaTeX. https://en.wikibooks.org/wiki/LaTeX. Accessed:
2016-08-30.
14