首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
代写MMME1027、代做Matlab语言程序
项目预算:
开发周期:
发布时间:
要求地区:
Programming, Professional and Laboratory Skills - MMME1027
Academic year 2023-2024
Page 1 of 12
COMPUTER PROGRAMMING WITH MATLAB
COURSEWORK 1
INTRODUCTION
This coursework will help you revise the Matlab skills you gained in lectures 1-4. It is worth 15% of the
module credits and will cover the following topics:
• Variables and arrays
• Solving equations
• Array manipulation to solve engineering problems.
Read the guidelines below as well as the mark sheet, so you know how marks will be awarded.
Download the data files from the Moodle page, as these are needed to answer some of the questions.
Follow all instructions carefully and consult the submission checklist before submitting your work.
The submission deadline for this coursework is: 4pm Thursday 7th March.
Programming, Professional and Laboratory Skills - MMME1027
Academic year 2023-2024
Page 2 of 12
GUIDELINES
• All answers are to be submitted in a single Matlab script file (i.e., ‘.m’) – no other file type is
acceptable. A template for this file is available on the course Moodle page, under the heading:
Matlab - Coursework 1.
• Put your name, student ID number and e-mail address at the start of the script preceded by the ‘%’
character.
• For questions which require you to write text answers (i.e., descriptive sentences), include these as
comments using the '%' character at the beginning of the line.
• Include comments in your script file describing what the program is doing and any features of note –
you will get marks for this.
• Once you have finished all the questions (or as many as you can manage), fill in the Submission
Checklist. This is available on Moodle and is there to help ensure your work is submitted properly.
• Save your script with a name in the following format: Firstname_Surname_studentid.m.
For example:
Julia_Smith_133444232.m
• Upload this file to Moodle in the appropriate submission box. Ensure that you upload before the
submission deadline, as late submissions without exceptional circumstances will be penalised.
• If you are in the process of applying for an EC for this coursework, be sure to submit whatever work
you have with ‘_pending’ appended to the file name by the deadline.
A WORD OF CAUTION – Remember this is individual work, not group work. Work handed in must be entirely
your own and not copied from anyone else. Discuss the coursework with your friends if needed, but answer
the questions yourself.
Programming, Professional and Laboratory Skills - MMME1027
Academic year 2023-2024
Page 3 of 12
Programming, Professional and Laboratory Skills - MMME1027
Academic year 2023-2024
Page 4 of 12
QUESTION 1 – VARIABLES [10 MARKS]
Evaluate the following functions at 𝑥 = 1.5:
Hint: Parts e and f can be solved without typing out the full equations.
g) Predict the pressure drop in a pipe 100 cm long with a radius of 1 cm. Assume the fluid is water
(µ = 1 × 10-3 Pa s) flowing at a rate of 100 cm3
/s.
You should use the Hagen–Poiseuille equation, which predicts pressure drop, ΔP, in laminar flow in
cylindrical pipes:
∆𝑃 =
8𝜇𝐿𝑄
𝜋𝑅4
where µ is the dynamic viscosity, L is the pipe length, Q is the volumetric flow rate and R is the pipe
radius.
Hint: You will need to carefully consider the units here. It may be helpful to convert all properties into SI
units before calculating the pressure drop.
Programming, Professional and Laboratory Skills - MMME1027
Academic year 2023-2024
Page 5 of 12
QUESTION 2 – ARRAYS & PLOTTING [13 MARKS]
Write a script to generate an array called 𝑥 with 25 points between 0 and 2𝜋. Then evaluate the following
functions over that range:
a) 𝑎 = sin2 𝑥
b) 𝑏 = cos2 𝑥
c) 𝑐 = tan2 𝑥
Add lines to the script to do the following:
d) Plot graphs of 𝑎 and 𝑏 against 𝑥.
e) On the same axes, plot a + b against x.
f) Make your graph clear and visually appealing by including axes labels, a legend, and by using
different linestyles for each data set.
g) Find the mean value of a. What change can you make to your code to improve the accuracy of this
prediction compared to the theoretical value? Give your answer as a comment using the ‘%’
character at the beginning of the line.
h) Use the same methods as above to solve this problem concerning an AC electrical circuit. If the
circuit operates with a peak current of 100 mA (see figure on the next page), what would be the
average power dissipated by a 1 kΩ resistor?
You can assume this is a simple circuit featuring only a resistor, with no capacitor or inductor. The
average power, 𝑃̅, dissipated by the resistor is given by:
𝑃̅ = 𝐼𝑟𝑚𝑠
2 𝑅
where 𝐼𝑟𝑚𝑠 is the square root of the mean squared current and 𝑅 is the resistance.
Programming, Professional and Laboratory Skills - MMME1027
Academic year 2023-2024
Page 6 of 12
Hint: As shown in the figure, the current can be modelled as a simple sin function, with an
amplitude of 100 mA, or 0.1 A. Start by creating this function, then calculate 𝐼𝑟𝑚𝑠, then find the
average power using the equation given above.
Programming, Professional and Laboratory Skills - MMME1027
Academic year 2023-2024
Page 7 of 12
QUESTION 3 – INBUILT FUNCTION EXAMPLES [10 MARKS]
Give examples of the use of the following inbuilt Matlab functions and describe concisely what they do. Use
the '%' character to include text comments in your .m file:
a) clearvars
b) who
c) abs
d) trapz
e) roots
Hint: Try using the help or doc command from the Matlab command line.
Programming, Professional and Laboratory Skills - MMME1027
Academic year 2023-2024
Page 8 of 12
QUESTION 4 – PROCESSING 1D ARRAYS [12 MARKS]
Whales are often beached near Lyme Regis on the south coast of the UK. Your company is developing an
underwater acoustic system to keep whales off the beach. The system will work by using an underwater
speaker to play a whale distress call.
It is your job to prepare the digital file which the system will play. By working with a marine biologist you
have obtained a recording of whale song. You can find this file in Coursework_1_data folder on Moodle.
Write a script to:
a) Load the whale song file into an array called 'song'. Plot a graph of the of the whale song featuring
appropriate label axes.
b) Make your script play the whale song sound. The required frequency is 44,100 samples per second.
What happens if you play more or less than 44,100 samples per second? Write your answer in your
script as a comment.
c) How many distinctive whale calls are there in the data? You should also be able to tell this from
looking at the graph. Write the answer as a comment in the script.
d) The second whale call in the sample is the distress call. By looking at the numbers on the x-axis of
your graph you will be able to tell at what position in the array this distress call starts and ends.
Make a new array which only contains the distress call - this should be called 'distress'.
e) Your company wants the device you are designing to play five whale distress sounds in a row. Make
a new array containing five distress calls one after the other and edit your script to play this sound.
f) If the computer plays 44,100 elements per second, make your script calculate the total length of
your repeated distress call in seconds.
g) Lastly, make an array representing the time over which the repeated distress call is played. Now plot
the repeated distress call with an appropriate time axis in seconds. Label the axes appropriately.
Programming, Professional and Laboratory Skills - MMME1027
Academic year 2023-2024
Page 9 of 12
QUESTION 5 – 2D ARRAYS [11 MARKS]
You are an engineer working for a private spaceflight company. You have been given some ground radar
data obtained from a drone aircraft and it is your task to identify a potential landing site for a small
unmanned reusable rocket. Download file ground_radar.dat from Moodle.
a) Load the topological data into an array and produce a 3D plot of the data using the surf function.
Hint: Matlab joins the points in 2D graphs with black lines by default. If there are lots of data points
this can make the graph look messy. Try adding the parameters,'edgecolor','none' to the plot
command to fix this.
b) The height data in the file is incorrect due to a miscalibration of the drone radar instrument. To
correct this error, you need to subtract 300 m from each data point in the array. The array will then
give the depth of each location below the drone’s mean altitude. Generate a new 2D array which
contains the corrected data and plot this.
c) Label the axes of your plot appropriately. The drone records data in a resolution of one data point
per meter.
d) Calculate the size of the area covered by the drone. Store the linear dimensions (i.e., the x and y
lengths) in separate variables, then calculate the total area of your map in a third variable.
e) From your 3D plot, locate a region which is relatively flat in which the rocket can land. Extract this
region from the array to form a new array called ‘landing_site’. The landing site should have
dimensions of at least 25 × 25 m, and be flat to within 1 m. To test the flatness, take the standard
deviation over the potential landing site area. Finally, produce a 3D plot of the landing site, again
labelling the axes properly.
Hint: You may not be able to find a site of the right flatness just by looking at your 3D plot from part
b. You may need to ‘sample’ potential landing sites by taking multiple sub-arrays from the ground
radar data and checking if the flatness is below 1 m. This could be done manually or with a for loop
and if statements.
Programming, Professional and Laboratory Skills - MMME1027
Academic year 2023-2024
Page 10 of 12
QUESTION 6 – FOR LOOP IMAGE PROCESSING [11 MARKS]
For this question you will use your programming skills to process an image, which, as you have learned, can
be treated in Matlab the same as other types of array.
An airline wants to rebrand its aircraft with a new exterior colour scheme. It has produced a mock-up of a
red painted design. But before the launch of the new design, the airline CEO asks to see other colour
concept designs. It is your job to make these. Start by downloading the image aeroplane.jpg from Moodle.
a) Load the aeroplane image into Matlab and show it onscreen. For this, use the imread and imshow
functions.
b) Find the size of the aeroplane image. You will notice that it has three dimensions, not two. You can
think of the image as having three separate layers, each of which is a 2D array. Each layer represents
an 8-bit colour channel; red, green and blue with values 0-255. Together, these make the full colour
image – like this:
Every pixel therefore has three coordinates: (x, y, P) – where P is just the layer number 1, 2 or 3. The
red channel is layer 1, the green channel is layer 2 and the blue channel is layer 3.
To access these in Matlab, you would write something like:
A = imread(‘aeroplane.jpg');
A(25, 50, 3) = 0;
which would set the pixel at (25, 50) in the blue channel (layer 3) to the value 0, or
A(:, :, 1) = 255;
which would set all of the red channel (layer 1) to the value 255.
Try this out by setting a rectangular patch of the aeroplane image blue channel to the value 255, the
highest value it can have. Show your result on screen.
c) To turn the red pixels of your aeroplane image into other colours, one simple way is swap the colour
channels. Start by making two nested for loops to scan over all the pixels in the image, and swap the
layer 1 layer 2 layer 3
Programming, Professional and Laboratory Skills - MMME1027
Academic year 2023-2024
Page 11 of 12
values in the red and green channels. This should show you what a green painted design would look
like. Show your result onscreen.
d) Now make a mock-up of a blue painted design using the same method as above and show your
result on screen.
Hint: For parts (c) and (d) it may be helpful to make additional copies of the aeroplane image which
you can scan over inside the nested for loops.
e) What are the shortcomings of using this method to modify the colours in the image? Can you
suggest a better way to colour modifications in images like this? Add comments to your script to
answer these questions.
Programming, Professional and Laboratory Skills - MMME1027
Academic year 2023-2024
Page 12 of 12
PRESENTATION AND FORMATTING [20 MARKS]
a) Code presentation is neat and clear, including:
i. Separate sections for each question.
ii. Meaningful, non-confusing variable names.
iii. No superfluous code which is not needed for the program to run.
iv. Semicolons to supress code output to screen.
[12 marks]
b) Comments are included to explain sections or lines of code which are non-intuitive, or where the
user needs additional information to use the program properly.
[6 marks]
c) Name and email address is given at the top of the code (i.e., in the Matlab script).
[2 marks]
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代写dts207tc、sql编程语言代做
2024-12-25
cs209a代做、java程序设计代写
2024-12-25
cs305程序代做、代写python程序...
2024-12-25
代写csc1001、代做python设计程...
2024-12-24
代写practice test preparatio...
2024-12-24
代写bre2031 – environmental...
2024-12-24
代写ece5550: applied kalman ...
2024-12-24
代做conmgnt 7049 – measurem...
2024-12-24
代写ece3700j introduction to...
2024-12-24
代做adad9311 designing the e...
2024-12-24
代做comp5618 - applied cyber...
2024-12-24
代做ece5550: applied kalman ...
2024-12-24
代做cp1402 assignment - netw...
2024-12-24
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!