Logical variables: Running late? Complete the tunction RunningLate such that the logical variable on Time is true if no Traffic is true and gasEmpty is false. Ex >> n°Traffic = true ; >> gasEmpty-false; >onTime - Runninglate(noTraffic,gasEmpty) logical Your Function B Save C Reset EE MATLAB Documentation 1 function onTime - RunningLate (noTraffic,gasEmpty) 2 % complete the logical expression to the right of . using the variables n°Traffic and gasEmpty 4 onTime - 6 end Code to call your function C Reset 1 noTraffic true; gasEmpty true; 2 onTime-Runninglate(noTraffic, gasEmpty)

Respuesta :

Answer:

"""""""""""""""""""""""""In case of any doubt please comment""""""""""""""""""""""""

Now we need the function to return true if noTraffic= true and gasEmpty = false;

NOTE:"Rest in all cases it should return false;

Now for that to happen we use and- operator (x & y) it returns true only when both x and y are true.

but we need true when gasEmpty = false. For that we will use not function on gasEmpty.

Now the function will return true (1) only when noTraffic = true and gasEmpty = false. Rest in all case it will return false (0)

​​​​​​​

function onTime = RunningLate (noTraffic, gasEmpty)

onTime = ( (noTraffic) & not(gasEmpty) )

end

The program was written in MATLAB. The program source file has an incomplete function, that needs to be completed.

Complete the function with the following code segment

function onTime = RunningLate (noTraffic, gasEmpty)

onTime = ((noTraffic) & not(gasEmpty))

end

The following, should be noted about the above code segment

  1. The first line declares/defines the function; The function name is RunningLate, and it receives noTraffic and gasEmpty as its parameters
  2. On the second line; If noTraffic is true and gasEmpty is false, the function will return true
  3. If otherwise, it will return false.

I've added the image of the complete question (in a more presentable format), as an attachment.

As stated above;

After running the complete program; onTime will be true if noTraffic and gasEmpty are true and false, respectively.

Read more about MATLAB programs at;

https://brainly.com/question/7247701

Ver imagen MrRoyal