Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Please review the first couple of examples and then uncomment and correct the missing expressions used in the following conditional statements. %% 51 matrix1= [

Please review the first couple of examples and then uncomment and correct the missing expressions used in the following conditional statements.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

%% 51 matrix1= [ "Erzincan", "van", "Sisam", "Sivrice", "Kusadasi", "ula", "Bor", "Nigde"); 1- % Print only the matrix elements that contain the character b "OR" has less % than or equal to 4 characters using a for loop - se de de % for expression1 % if expressioni expression2 % disp(matrix(i)) % end % end 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 1 % Tip: use strlength() and contains() % Tip: You need to use a different logical operator for the if statement % Check Logical (Boolean) Operations help document. %% 6 % Let's check if the variable is bigger than or equal to 500: var1=550; T % if expression1 % disp('true') % end 122 %% 9 123 124 125 126 % Let's write a conditional statement for 2 different cases where unit is % either Nm or dyne_cm (character array!) unit = 'Nm'; 127 128 129 TE % if expression1 disp('Newtonmeters) % elseif expression2 % disp('Dynecentimeters) % end 130 131 132 133 134 135 136 %% 10 % L is the following matrix % rowl: 3 100 99 55 85 % row 2: 4 101 100 54 75 % row3: 2 8 1 101 76 137 138 139 140 141 142 143 144 145 % 10.1 Write the Matlab expression to define this matrix % 10.2 Write the Matlab expression that extracts the 3rd and 4th columns of L and % saves them as a new matrix called M %% 1 % Let's check if the variable is a number clear var1=15; mm mmm if isnumeric(varl) disp('yes vari is a number') end %% 2 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 % Let's check if the variable is a number and also an even number if isnumeric(varl) & mod(var1, 2) == 0 disp('yes,vari is a number and also an even number') else disp('no it is not') end NE %% 3 % Let's check if the variable is a number and but not an even number if isnumeric(vari) & mod(var1,2) disp('yes,vari is a number but not an even number) else disp('no it is an even number') end 57 %% 4 58 59 60 61 % % Check if the variable is a string and is "Girne" varl = "Girne"; 62 63 64 65 66 67 68 69 % if expressioni expression2 % disp('yes it is a string and is Girne') % elseif expressioni expression2 % disp('no it is a string but is not Girne') % elseif expression1 % disp('no it is not a string at all') % end %% 7 % Let's check if the 5th element of the matrix is lower than 6 but bigger than 5 matrix1=[ 38.5376 39.4421 7.0 0.13 5.5]; 96 97 98 99 100 101 102 103 % if expression1 expression 2 % disp('true') % end %% 8 matrix2=[ 38.5376 39.4421 7.0 0.13 5.5;... 7.9480 26.7293 16.51 0.6 6.2]; % for expressioni 1- 104 105 106 107 108 109 110 111 112 113 114 115 116 % % Let's check if the 5th column of the matrix is lower than 6 but % % bigger or equal to 5 % if expressioni expression2 % disp('A moderate earthquake') % % % Check if the 5th column of the matrix is lower than 7 but bigger or % % or equal to 6 % elseif expressioni expression2 disp('A strong earthquake') % end % end 117 118 119 1

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

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students explore these related Databases questions