Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In the following MATLAB program, I am trying to find how many times that a face card is drawn from a deck of 52 poker
In the following MATLAB program, I am trying to find how many times that a face card is drawn from a deck of 52 poker cards when I draw a card, replace it, and reshuffle the deck 1000 times.
For some reason the output is always 12 cards, but I count alot more for 1000 draws. I think the Cards Matched variable is wrong.
MATLAB FILE
% Define face cards. clc faceCards = [11,12,13, 24,25,26, 37,38,39, 50,51,52] ; % Shuffle the deck and get the first two cards. s = RandStream('mlfg6331_64'); cardsDrawn = datasample(s,1:52,1000); %Draws 1000 times % See if any of these cards is a face card ia = ismember(cardsDrawn, faceCards) CardsMatched = sum(ismember(faceCards,cardsDrawn)) %%% Gives the amount of matches RatioMatch = CardsMatched/1000 PercentageMatch = RatioMatch * 100
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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