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

1 次查看(过去 30 天)
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 个评论
EKAIN
EKAIN 2022-12-2
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.

请先登录,再进行评论。

回答(1 个)

Image Analyst
Image Analyst 2022-12-2
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

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by