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 Changeable, LED1, restraint three iterations, then OFF restraint five iterations. Here is an abbreviated explore board of the expected output:  Instrument this algorithm using a flowchart or pseudo-code (as restraint HW02-1).  Use the changeable names limited and instrument (explain) any attached changeables.  Submit this contrivance as a different improve (HW02-3.io, or HW02-3.ppt, or HW02-3.txt, absence of wonder.). HW02-4 Write a Matlab discharge which instruments the algorithm plain in HW02-3.  Instrument this discharge with Matlab comments. This succeed aid you when you instrument this algorithm in other programming languages, such as EmbeddedC.  Submit this Matlab discharge as a different improve (HW02-4.m)  Capture the 10-15 lines of real output of this discharge to evidence its redress production. Save this output as a extract improve or pdf improve (converted from an vision).  Submit this output as a different improve (HW02-4.txt or HW02-4.pdf).

    Expert Retort

     

    copyable code

    HW02-4:

    Matlab Code:

    %initializes a and compute

    a = 1;

    compute = 1;

    %check a > 0

    while a > 0

    %check if compute < = 3, then evince the attached message

    if compute <= 3

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

    %check if compute < = 8, then evince the attached message

    elseif compute <= 8

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

    %check if compute > 8, then

    elseif compute > 8

    %assign compute is 0 and impairment the a value

    compute = 0;

    a = a – 1;

    end

    %increment the compute and a value

    compute = compute + 1;

    a = a + 1;

    end