Answer:
The weather conditions do not suggest a blizzard. It is explained below.
Explanation:
wind_speed=randi([12 56],24,1);
visibility=randi([1 10],24,1)/10;
storm_data=[wind_speed,visibility];
save stormtrack.dat storm_data -ascii
clear
load stormtrack.dat
fprintf('Below is the storm data from the file stormtrack.dat \n');
disp(stormtrack)
wind_speed=stormtrack(:,1);
visibility=stormtrack(:,2);
L=length(wind_speed);
count=0;
i=0;
while count<4 && i<L
i=i+1;
if wind_speed(i)>=30 && visibility(i)<=0.5
count=count+1;
else
count=0;
end
end
if count==4
fprintf('The weather conditions suggest a blizzard.\n')
else
fprintf('The weather conditions do not suggest a blizzard.\n')
end
Results:
Below is the storm data from the file stormtrack.dat
49.0000 0.1000
56.0000 0.4000
44.0000 0.6000
27.0000 0.7000
38.0000 0.5000
16.0000 0.9000
52.0000 0.8000
1 51.0000 1.0000
48.0000 0.6000
23.0000 0.4000
38.0000 0.2000
13.0000 0.7000
31.0000 0.8000
26.0000 0.5000
19.0000 0.1000
20.0000 0.3000
31.0000 0.2000
16.0000 0.3000
38.0000 0.5000
33.0000 0.6000
43.0000 0.5000
43.0000 0.9000
40.0000 0.6000
13.0000 1.0000
The weather conditions do not suggest a blizzard.