Borrar filtros
Borrar filtros

What statement should I put?

2 visualizaciones (últimos 30 días)
Zach Hanses
Zach Hanses el 14 de Dic. de 2021
Respondida: Walter Roberson el 14 de Dic. de 2021
What statement would show the days that fit the condition below?
for i = 1:length(n-1)
if (avePrecipitation7Days<1 & aveDailyTemp>2)
plantingDates = ????
end
end
Background: I am trying to find the most suitable days to plant. avePrecipitation7Days and aveDailyTemp are both 1x244.

Respuestas (1)

Walter Roberson
Walter Roberson el 14 de Dic. de 2021
Something like this?
mask = (avePrecipitation7Days<1) & (aveDailyTemp>2);
Indicator = strings(size(mask));
Indicator(mask) = "GO";
Indicator(~mask) = "no"
Question: what are your units? millimetres of precipitation ? Degrees Celcius? Is that "average" for temperature including nighttime, or is it the daytime high?
If those are millimetres and Celcius, then where I live, you would be selecting April 7th to April 14th, and October 14th to October 21st only. Before April 7th the mean daily temperature is too low; after April 14th the 7 day average precipitation is too high. Before October 14th the 7 day average precipitation is too high; after October 21, the mean daily temperature is too low.
Early April is considered to be a minimum of one month too early to plant crops here: the ground has not thawed yet, and there too much chance of a frost. Mean daily temperature does not tell you much about frost risk: our averge high for April is 10C but our average low (considering the whole month) is -2C .

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by