how to find the days haven't been precipitations in a vector or a file.

1 view (last 30 days)
Need to solve this, every help would be nice, thanks.
Specially the most difficul one is to find the days when have been no precipitations.
Implement a function called computePrecipitationStats which, given the vector that contains the daily precipitations and a threshold value, returns the average daily precipitation, the standard deviation of the daily precipitations, the number of days with no precipitation and vector containing the days when the precipitation was above the specified threshold.
  3 Comments
EKAIN
EKAIN on 2 Dec 2022
I need to know how to calculate how many elements there are with value 0 in the vector. I have written the exercise to put people in context of the problem.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 2 Dec 2022
Hints:
v = randi([0, 5], 1, 20)
v = 1×20
5 2 3 1 5 1 4 4 3 0 5 3 5 2 2 5 0 2 3 4
numZeros = sum(v == 0)
numZeros = 2
valuesAboveThreshold = v(v > 3) % 3 is the threshold
valuesAboveThreshold = 1×8
5 5 4 4 5 5 5 4

Categories

Find more on MATLAB 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!