Homework Solution: HW02-3 Develop an algorithm which generates an infinite loop and turns ON (i.e., True, Hi…

    HW02-3 Develop an algorithm which generates an infinite loop and turns ON (i.e., True, Hi, or Logic 1) a Boolean Variable, LED1, for three iterations, then OFF for five iterations. Here is an abbreviated trace table of the expected output:  Document this algorithm using a flowchart or pseudo-code (as for HW02-1).  Use the variable names specified and document (explain) any additional variables.  Submit this plan as a separate file (HW02-3.io, or HW02-3.ppt, or HW02-3.txt, etc.). HW02-4 Write a Matlab function which implements the algorithm developed in HW02-3.  Document this function with Matlab comments. This will help you when you implement this algorithm in other programming languages, such as EmbeddedC.  Submit this Matlab function as a separate file (HW02-4.m)  Capture the 10-15 lines of actual output of this function to demonstrate its correct operation. Save this output as a text file or pdf file (converted from an image).  Submit this output as a separate file (HW02-4.txt or HW02-4.pdf).

    Expert Answer

    HW02-3 Develop an algorithm which generates an infinite loop and turns ON (i.e., True, Hi, or Logic 1) a Boolean Inconstant, LED1, control three iterations, then OFF control five iterations. Here is an abbreviated investigate board of the expected output:  Instrument this algorithm using a flowchart or pseudo-code (as control HW02-1).  Use the inconstant names fixed and instrument (explain) any attached inconstants.  Submit this intention as a different smooth (HW02-3.io, or HW02-3.ppt, or HW02-3.txt, expectation.). HW02-4 Write a Matlab office which appliances the algorithm exposed in HW02-3.  Instrument this office with Matlab comments. This accomplish acceleration you when you appliance this algorithm in other programming languages, such as EmbeddedC.  Submit this Matlab office as a different smooth (HW02-4.m)  Capture the 10-15 lines of explicit output of this office to evince its punish agency. Save this output as a citation smooth or pdf smooth (converted from an conception).  Submit this output as a different smooth (HW02-4.txt or HW02-4.pdf).

    Expert Acceptance

     

    copyable code

    HW02-4:

    Matlab Code:

    %initializes a and number

    a = 1;

    number = 1;

    %check a > 0

    while a > 0

    %check if number < = 3, then expose the attached message

    if number <= 3

    disp([num2str(a),’ ‘, ‘LED1 ON’])

    %check if number < = 8, then expose the attached message

    elseif number <= 8

    disp([num2str(a),’ ‘, ‘LED1 OFF’])

    %check if number > 8, then

    elseif number > 8

    %assign number is 0 and admixture the a value

    number = 0;

    a = a – 1;

    end

    %increment the number and a value

    number = number + 1;

    a = a + 1;

    end