Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a GUI implemented in MATLAB using App Designer that calls the three functions in Tasks 1 3 . tasks are based on Buffon s
Write a GUI implemented in MATLAB using App Designer that calls the three functions in Tasks tasks are based on Buffon s needle experiment for example this is task one : "function p crossings BuffonStandardPi width length throws crossings ; for n :throws Randomly place the needle's midpoint and angle midpoint width rand ; angle pi rand ; Calculate the distance from the midpoint to the nearest line distance to line min midpoint width midpoint ; Check if the needle crosses a line if distance to line length sin angle crossings crossings ; end end Estimate pi using the crossings if crossings p length throws width crossings ; else p Inf; If no crossings, the estimate of pi goes to infinity end end" The GUI must Allow the user to select which task is run. Allow the user to adjust the number of needles, dropped squares, and parallel planks of wood, from default values. The program should allow at least needles dropped squares and parallel planks of wood. Note: not all needles need to be displayed if more than are dropped. Before running the simulation allow the user to adjust the sizes of the needles, dropped squares, and parallel planks of wood from default values. Display the parallel planks of wood. Display the dropped needles squares Highlight in a different colour all needles dropped squares that intersect the cracks between planks. Display the value estimated by the Monte Carlo simulation. Allow the user to customize elements of the displayed value e g font size, colour an additional function to be applied to Task needle dropping only: It should allow the user to select a needle by clicking on or near it with the mouse. The needle will then be highlighted in a different colour and The n needles with most similar orientation will then be highlighted in yet another colour. The default value is n and the value of n can be modified through the GUI. Allow a mixture of different sized needles to be used. Support saving and loading back sets of needles such that previous results can be combined to produce better estimates.
Write a GUI implemented in MATLAB using App Designer that calls the three functions in Tasks
tasks are based on
Buffon
s needle
experiment
for example this is task one :
"function
p
crossings
BuffonStandardPi
width
length throws
crossings
;
for n
:throws
Randomly place the needle's midpoint and angle
midpoint
width
rand
;
angle
pi
rand
;
Calculate the distance from the midpoint to the nearest line
distance
to
line
min
midpoint
width
midpoint
;
Check if the needle crosses a line
if distance
to
line
length
sin
angle
crossings
crossings
;
end
end
Estimate pi using the crossings
if crossings
p
length
throws
width
crossings
;
else
p
Inf;
If no crossings, the estimate of pi goes to infinity
end
end"
The GUI must
Allow the user to select which task is run.
Allow the user to adjust the number of needles, dropped squares, and parallel planks of wood, from default values. The program should allow
at least
needles
dropped squares and
parallel planks of wood. Note: not all needles need to be displayed if more than
are
dropped.
Before running the simulation allow the user to adjust the sizes of the needles, dropped squares, and parallel planks of wood from default
values.
Display the parallel planks of wood.
Display the dropped needles
squares
Highlight in a different colour all needles
dropped squares that intersect the cracks between planks.
Display the value estimated by the Monte Carlo simulation.
Allow the user to customize elements of the displayed value
e
g
font size, colour
an additional function to be applied to Task
needle dropping only:
It should allow the user to select a needle by clicking on or near it with the mouse. The needle will then be highlighted in a different colour and The n needles with most similar orientation will then be highlighted in yet another colour. The default value is n
and the value of n can
be modified through the GUI.
Allow a mixture of different sized needles to be used.
Support saving and loading back sets of needles such that previous results can be combined to produce better estimates.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started