Answer:
Explanation:
Firstly, let's define several variables which are necessary to hold the value of total of Fibonacci sequence, sum, Fibonacci index, n and Fibonacci term, f (Line 1 - 3). We can get the first Fibonacci term using the Matlab built-in function fibonacci() (Line 3).
Since the Fibonacci term should be less than or equal to 500, create a while condition that meet the requirement (Line 5). Within the while loop, check if the current Fibonacci term is an even number. This can be achieved by using mod() function to calculate the f modulus by 2 (Line 6). If the result is zero, the f is an even number and f value will be added with variable sum.
Next increment the Fibonacci index by 1 and use the same function fibonacci() to get the next Fibonacci term, f, and repeat the same process as described above until the f becomes bigger than 500.
At the end, display the result (Line 13). The result shall be 188.