Question: 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 Buffons needle experiment.
for example this is task one :
"function p crossings BuffonStandardPiwidth 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
distancetoline minmidpoint width midpoint;
Check if the needle crosses a line
if distancetoline length sinangle
crossings crossings ;
end
end
Estimate pi using the crossings
if crossings
p length throwswidth 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 needlesdropped 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 needlessquares
Highlight in a different colour all needlesdropped 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 eg 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
