Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can u do this please ? b) An engineer develops a program in MATLAB to predict flood due to heavy rainfall in Malaysia. The program

Can u do this please ? image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
b) An engineer develops a program in MATLAB to predict flood due to heavy rainfall in Malaysia. The program should correlate amount of rainfall and water level of the river. As trial, the engineer creates a short program for three river monitoring stations in Johor as given in Table 1.1. Table 1.1 River monitoring stations in Johor River monitoring Danger Level (m) City stations Johor Bahru Kota Tinggi Segamat Sg.Skudai Sg Johor Sg.Lenik 3.00 9.80 6.00 The program should receive input of rainfall precipitation and expected to give warning when the water level exceeds the danger level which that can cause floods, alert message when water level rise from normal level or safe message if water at normal level. In order to create the program, the engineer gathers information as below: Q = 0.1767P +0.8248 (1.1) Equation 1.1 obtained from regression of historical data of precipitation, P (mm) and water flowrate, Q (m's). (BH)/ V5 Qr n(B + 2H)3/5 (1.2) Equation 1.2 used to estimate the flowrate of a river. (m's) where S is slope (m/m). His depth (m), B is river width (m) and n is Manning roughness coefficient. The parameter for each river is given in Table 1.2 below. Table 2.1 Parameters of river in Johor River Sg Skudai 0.0003 18 0.05 Sg Johor 0.0001 23 Sg Lenik 0.0002 0.095 S B n 0.14 20 The engineer creates a program by comparing the maximum , calculated at danger level of height with Q. If Q is greater than Or, thus the water level exceeds the river danger level, while if Q is around 70% of Or, it is at alert level otherwise it is at normal level. The expected results of the program are shown in Figure 1.1. Nevertheless, the engineer encountered problems where program in Figure 1.2 has 20 errors messages. As an expert, help the engineer to analyse Question 1 - Page 3 the errors messages shown in Figure 1.3. Rewrite all the MATLAB commands with corrections in Figure 1.4. Remain the program structure and number of lines as original MATLAB program. In your answer, please highlight fixed errors using highlighter (40 Marks) Cand Write >> Flood Prediction Select city Johor Nahru/eganat sota Tinsleborahru Average Precipitation -)-126 Keror in input.ph try again >> Food Prediction Select city: Johor Bahru/Segamat/Kota Tinggi Jhor Bahru Average Precipitation tm)-120 !!! ALERT! Water level rise above surmal level at del river in Johor Bahru City >> >> Flood Prediction Select city: Johor Bahru/Segamat/Kota Tinggi Segamat Average Precipitation)-100 ***Water Level at Selenik, Segamats omalt >> >> Food Prediction Select city: Johor Bahru/Segamat/Kota Tinggi Dota Tinggi Averago Precipitation --320 !!! KUMBE varution meded. So Juhos tives in tota the city exceed the danger level. Please evacuate people to the nearest eater Figure 1.1 Expected results of program executed for different cases. Question 1 - Page 4 1 2 city=input('Select city: Johor Bahru/Segamat/Kota Tinggi '); P-input('Average Precipitation (mm)"): Q-0.1767.0.8248; switch City 3 4 5 case Johor Bahru 6 7 8 9 10 11 $40.0003;B=16;n=0.05; Emax 3.0: Location 'Sg Skudai; case Segamat 5=0.0002;B=20;n=0.095; Himax=6.0; Location 'Sg Lenik: case Kota Tinggi $ 0,0001;323;n=0.14: Hmaxm9.8: Location='sg Johor': otherwise disp('Error in input. Please try again return 12 13 14 15 16 17 18 19 20 21 22 Qr={(BHmax) (5/3)*sqrt(s)" (B+2Hmax) * (2/3): if Q>Or fprintf(" !!! WARNING! Evacution needed. 55.26 river in $5.2f city exceed the danger level.la , location, city) di sp('Please evacuate people to the nearest evacuation center.') elseit Or0.7 fprintf(" !!! ALERT! Water level rise above normal level at 55.26 river in 15.2 city ', Location.city) elseit fprint(' ***Water Level at 15.28, 35.25: Normal Levelin', Location.city) 23 24 25 26 Figure 1.2 The MATLAB program that contains errors Question 1 - Page 5 >> Flood Prediction2 Error: File Flood Prediction. Lines 5 Columns 16 Invalid expression. Check for missing multiplication operator, in or unbalanced delimiters, or other syntax error. To construet satrices, se brackets instead of parentheses. >> Flood Prediction2 Error: File Flood Prediction2. Line: 11 Colom: 15 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses. >> Flood Prediction2 Error: File: Flood Prediction Line: 18 Column: 34 Invalid expression. Check for missing multiplication operator, minning on unbalanced delimiters, or other syntax error. To construct matrices, brackets instead of parentheses. >> Flood prediction2 Error: File Flood Prediction Line 2 Columns Invalid expression. Check for missing or extra characters. >> Flood Prediction2 Error: File Flood Prediction.m Line: 19 Column: 1 At least one END in missing the statement may begin here > FloodPrediction2 Error: Flie: Flood Prediction. Lins 4 Columns At least one HD Ling: the statement may begin here. >> PloodPrediction2 Select city: Johor Bahru/Segamat/Kota Tinggi Johor Bahru Select city: Johor Bahru/Segamat/Kota Tinggi Johor Bahru Select city: Johor Bahru/Segamat/Kota Tinggi Operation terminated by user during lave EditorEvaluation operasection valeb4c2068 (line 13 In matlab.internal.editor evaluateCode >> Flood Prediction2 Select city: Johor Bahru/Segamat/Kota Tinggi Johor Bahru Average Precipitation (mm) - 124 Underined function of variable City Error in Flood Prediction2 (line 4) switch City >> Flood Prediction2 Select city: Johor Bahru/Segamat/Kota Tinggi - Johorbahru Average Precipitation (mm) 124 Undefined function or variable Segamat. Error in Flood Prediction2 (line 8) caso Segamat >> Flood Prediction2 Select city: Johor Bahru/Segamat/Kota Tinggi Johor Bahru Average Precipitation (mm) 124 Undefined function or variable *00. Error in Flood Prediction2 (line 22) elseif 10.7 Question 1 - Page 6 Name: Section and lecturer: >> Flood Prediction 2 Select city: Johor Bahru/Segamat/Kota Tinggi= Johor Bahru Average Precipitation (mm) -124 !!! ALERT! Water level rise above normal level at 83.00 river in 103.00 city !!! ALERT! Water level rise above normal level at 32.00 river in 83.00 city !!! ALERT! Water level rise above normal level at 107.00 river in 117.00 city !!! ALERT! Water level rise above normal level at 100.00 river in 97.00 city !!! ALERT! Water level rise above normal level at 105.00 river in 74.00 city !!! ALERT! Water level rise above normal level at 111.00 river in 104.00 city !!! ALERT! Water level rise above normal level at 111.00 river in 114.00 city !!! ALERT! Water level rise above normal level at 32.00 river in 66.00 city !!! ALERT! Water level rise above normal level at 97.00 river in 104.00 city !!! ALERT! Water level rise above normal level at 114.00 river in 117.00 city > FloodPrediction 2 Select city: Johor Bahru/Segamat/Kota Tinggi-Segamat Average Precipitation (mm) 100 Undefined function 'print' for input arguments of type 'chart Error in Flood Prediction2 line 25) fprint("\ nWater Level 5.26, 15.263 Normal Levelin, Location, city) >> Flood Prediction2 Select city: Johor Bahru/Segamat/Kota Tinggi Kota Tinggi Average Precipitation (mm) - 320 Undefined function or variable location'. Error in Flood Prediction2 (line 20) fprintf(" !!! WARNING: Evacution needed. 35.26 river in 5.25 city exceed the danger level.nl, location.city) Figure 1.3 Compilation of error messages in the command window

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems On GPUs In Databases

Authors: Johns Paul ,Shengliang Lu ,Bingsheng He

1st Edition

1680838482, 978-1680838480

Students also viewed these Databases questions

Question

What two types of cybersecurity examinations are available?

Answered: 1 week ago