How to simulate the number of ice-creams sold per hour ?
Show older comments
I have the following code and I need to adjust the value of Am, B and D so that the cosine function shows the 1st and 24th rows are roughly equal to 50 and 12th row is roughly equal to 5. Now I have played with the values more than 100 times but none of them meets the condition.
Am=20;%Amplitude, play with the value
B=6;%Frequency,play with the value
C=0;%Phase, the phase's value is constant, it won't be changed
D=14;%Offset, play with the value
for j=1:7;%makes 7 columns
for i=1:24;%makes 24 rows
A(i,j)=Am*cos(B*i+C)+D
end
end
surf(A)%plots a cosine curve
[NOTE: The 24 rows represents the 24 hours (first row is 12 o'clock at noon) and 7 columns represents the 7 days in a week. The requirement is : Simulate the number of icecreams sold per hour during one week in a particular store in a warm summer week. We accept fractional number of icecreams ! Suppose that a icecream store sells about 50 icecreams per hour at noon, and about 5 icecreams per hour at midnight. Lets have a random fluctuation of about +/- 2 icecreams per hour. Lets start by assuming that every weekday has the same icecream sales.]
Accepted Answer
More Answers (0)
Categories
Find more on Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!