Could you please help me create a graphical user interface in MATLAB? Module 2a: function dates = module_2a(n) dates=[]

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Could you please help me create a graphical user interface in MATLAB? Module 2a: function dates = module_2a(n) dates=[]

Post by answerhappygod »

Could you please help me create a graphical user interface in
MATLAB?
Could You Please Help Me Create A Graphical User Interface In Matlab Module 2a Function Dates Module 2a N Dates 1
Could You Please Help Me Create A Graphical User Interface In Matlab Module 2a Function Dates Module 2a N Dates 1 (151.11 KiB) Viewed 35 times
Module 2a:
function dates = module_2a(n)

dates=[];

for count = 1: n

random_month = randi([1 12], 1,1); % generate a random month 1 to
12
month = random_month(1,1);
if (month == 4 || month == 6 || month==9 || month==11 )
day = randi([1 30], 1,1); % there are 30 days
else if month==2
day = randi([1 28], 1,1); % there are 28 days
else
day = randi([1 31], 1,1); % there are 31 days
end
dates = [dates; [month,day]];

end
end
Module 2b:
function bmatch = module_2b(data)
% loop over "data" array
for eachValueInDataArr = data
% if count of current element in data
array is greater than 1
if sum(data == eachValueInDataArr) >
1
% return 1
bmatch = 1;
return;
end
% else, return 0
bmatch = 0;
end
end
Module 1:
n = linspace(2,365,364);
p = (1)-exp(-n.^(2)/730);
figure(1)
plot(n, p)
Could You Please Help Me Create A Graphical User Interface In Matlab Module 2a Function Dates Module 2a N Dates 2
Could You Please Help Me Create A Graphical User Interface In Matlab Module 2a Function Dates Module 2a N Dates 2 (123.33 KiB) Viewed 35 times
For this part of the project, you're required to simulate the birthday scenario: Call your function from module 2a to assign random birthdays to people in an increasingly large group of people (starting with a group size of 2 people and ending with a group size of 365). This function can be modified so it just generates whole numbers from 1 to 365 to represent each day (rather than the day/month format from module 2a), this will make the program less computationally complex but will still give you the same result. Use the function from module 2b to check these dates to see if there are any repeated birthdays in the groups. Keep a record of any matches discovered. Using the knowledge gained from module 1, you'll then plot a graph of the probabilities of a shared birthday from your simulation with a graph of the theoretical model overlayed (x-axis = group size, y-axis = probability). The graph must be displayed on your GUI (so you'll use app.UlAxes to display your results). To obtain a close statistical model to the theory, you'll need to repeat your simulation many times and take the average over the number of realisations (at least 10 times, but less than 500 times to ensure the simulation doesn't take too long).

Your GUI must be able to obtain user input including: How many realisations does the user want in order to obtain an estimate of the probability of a shared birthday (allow user to select numbers between 10 and 500). This will allow the simulation to either be fast but less accurate (10 times) or slow and more accurate (500 times). The maximum group size the user wants simulated. This will truncate the graph to the maximum group size. The range of this must be a minimum of 2 people and a maximum of 365 people in a group. You'll need to think not only about the way your program calculates the output required to solve the problem (its functionality) but also how your GUI will look (its aesthetics) and how simple it is for a user to input and receive output from your program (its usability). Your graphical user interface (GUI) must be created in App Designer (DO NOT use the menu () or dialog() functions or GUIDE!!!). You must submit the .mlapp file and user- defined functions in .m file format for assessment.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply