Comp755 HW 2 – Fall 2015 1. Problem 4.2 (10pts) 2. Problem 4.4 (15pts) 3. Problem 5.25 (10pts) 4. Problem 10.2 (15pts) . Hint: Create three Gantt charts where each square represents 10 time units. a. The first chart should use earliest deadline using the processes that are currently available. Since there is no preemption, some processes will not be scheduled if there start deadline is missed. b. The second chart should schedule strictly by the earliest deadline. The processor will be idle if the process with the earliest deadline has not arrived. c. The third chart should just use FCFS. 5. (Synchronize threads) Write a program that launches 1,000 threads. Each thread adds 1 to a variable sum that initially is 0. You need to pass sum by reference to each thread. In order to pass it by reference, define an Integer wrapper object to hold sum. Run the program with and without synchronization to see its effect (Create a command line argument where passing a 0 means run unsynchronized and passing a 1 means to run synchronized). Submit your entire Netbeans project (50pts).

Comp755 HW 2 – Fall 2015 1. Problem 4.2 (10pts) 2. Problem 4.4 (15pts) 3. Problem 5.25 (10pts) 4. Problem 10.2 (15pts) . Hint: Create three Gantt charts where each square represents 10 time units. a. The first chart should use earliest deadline using the processes that are currently available. Since there is no preemption, some processes will not be scheduled if there start deadline is missed. b. The second chart should schedule strictly by the earliest deadline. The processor will be idle if the process with the earliest deadline has not arrived. c. The third chart should just use FCFS. 5. (Synchronize threads) Write a program that launches 1,000 threads. Each thread adds 1 to a variable sum that initially is 0. You need to pass sum by reference to each thread. In order to pass it by reference, define an Integer wrapper object to hold sum. Run the program with and without synchronization to see its effect (Create a command line argument where passing a 0 means run unsynchronized and passing a 1 means to run synchronized). Submit your entire Netbeans project (50pts).

info@checkyourstudy.com Whatsapp +919911743277
Lab Assignment-Matlab 1 Note: You should write your solutions in a Word file and upload it to D2L. For each problem, you shall specify the commands you used in MATLAB as well as the solutions shown in MATLAB. This can be done by copying the text from MATLAB’s command window then paste them onto your Word file. Read chapters 1.1-1.5 of the textbook (Introduction to MATLAB 7 for Engineers), solve the following problems in MATLAB. Suppose that x=9 and y=7. Use MATLAB to compute the following, and check the results with a calculator. a) 1/(1-1/x^5 ) b) 3Πx^3 c) 4y/(5x-9) d) (3(y-7))/(9x-5) Assuming that the variables a, b, c, d, and f are scalars, write MATLAB statements to compute and display the following expressions. Test your statements for the values a=1.2, b=2.34, c=0.72, d=0.81, e= 1.29 and f=19.83. a) x=1+a/b+c/d^2 + e/f^3 b) s= (b-a+e)/(d-c+f) c) r=1/(1/a+1/b+1/c+1/d-1/f) d) ab/d f^2/2 The volume of a sphere is given by V= (4/3)*Πr^3, where r is the radius. Use MATLAB to compute the radius of a sphere having a volume 36 percent greater than that of a sphere of radius 4 ft. Suppose x takes on the values x=1, 1.2, 1.4…, 5. Use MATLAB to compute the array y that results from the function y=sin⁡〖(4x).〗 Use MATLAB to determine how many elements are in the array and the value of the third element in the array y. Use MATLAB to determine how many elements are in the array sin⁡(-π/2):0.05: cos⁡(0). Use MATLAB to determine the 10th element. Use MATLAB to calculate e^(〖(-2.5)〗^3 )+3.47 log⁡〖14+ ∜287〗 (3.4)^7 log⁡〖14+ ∜287〗 〖sin〗^2⁡(4.12Π/6) sin⁡〖(4.12Π/6)^2 〗 Use MATLAB to plot the functions u=2 log_10⁡(6x+5)and v=3 sin⁡(7x) over the interval 0≤x≤2. Properly label the plot and each curve. The variables u and v represent speed in miles per hour; the variable x represents distance in miles. Example1, Suppose that x = 2 and y = 5. Use MATLAB to compute the following. You should put the following in your Word file >> x = 2; >> y = 5; >>(y*x^3)/(x-y) ans = -13.3333 Example 2, Use MATLAB to plot the function Put a title on the plot and properly label the axes. The variable T represents temperature in degrees Celsius; the variable t represents time in minutes. You should report like the following: >> t=linspace(1,3,100); >> T=6*log(t)-7*exp(0.2*t); >> plot(t,T); >> xlabel(‘t (minutes)’); >> ylabel(‘T (^oC)’); >> title(‘Change of temperature with time’); Also paste the resultant figure in the Word file (select from the figure window: Edit .Copy Figure, then paste in your Word file), you should have

Lab Assignment-Matlab 1 Note: You should write your solutions in a Word file and upload it to D2L. For each problem, you shall specify the commands you used in MATLAB as well as the solutions shown in MATLAB. This can be done by copying the text from MATLAB’s command window then paste them onto your Word file. Read chapters 1.1-1.5 of the textbook (Introduction to MATLAB 7 for Engineers), solve the following problems in MATLAB. Suppose that x=9 and y=7. Use MATLAB to compute the following, and check the results with a calculator. a) 1/(1-1/x^5 ) b) 3Πx^3 c) 4y/(5x-9) d) (3(y-7))/(9x-5) Assuming that the variables a, b, c, d, and f are scalars, write MATLAB statements to compute and display the following expressions. Test your statements for the values a=1.2, b=2.34, c=0.72, d=0.81, e= 1.29 and f=19.83. a) x=1+a/b+c/d^2 + e/f^3 b) s= (b-a+e)/(d-c+f) c) r=1/(1/a+1/b+1/c+1/d-1/f) d) ab/d f^2/2 The volume of a sphere is given by V= (4/3)*Πr^3, where r is the radius. Use MATLAB to compute the radius of a sphere having a volume 36 percent greater than that of a sphere of radius 4 ft. Suppose x takes on the values x=1, 1.2, 1.4…, 5. Use MATLAB to compute the array y that results from the function y=sin⁡〖(4x).〗 Use MATLAB to determine how many elements are in the array and the value of the third element in the array y. Use MATLAB to determine how many elements are in the array sin⁡(-π/2):0.05: cos⁡(0). Use MATLAB to determine the 10th element. Use MATLAB to calculate e^(〖(-2.5)〗^3 )+3.47 log⁡〖14+ ∜287〗 (3.4)^7 log⁡〖14+ ∜287〗 〖sin〗^2⁡(4.12Π/6) sin⁡〖(4.12Π/6)^2 〗 Use MATLAB to plot the functions u=2 log_10⁡(6x+5)and v=3 sin⁡(7x) over the interval 0≤x≤2. Properly label the plot and each curve. The variables u and v represent speed in miles per hour; the variable x represents distance in miles. Example1, Suppose that x = 2 and y = 5. Use MATLAB to compute the following. You should put the following in your Word file >> x = 2; >> y = 5; >>(y*x^3)/(x-y) ans = -13.3333 Example 2, Use MATLAB to plot the function Put a title on the plot and properly label the axes. The variable T represents temperature in degrees Celsius; the variable t represents time in minutes. You should report like the following: >> t=linspace(1,3,100); >> T=6*log(t)-7*exp(0.2*t); >> plot(t,T); >> xlabel(‘t (minutes)’); >> ylabel(‘T (^oC)’); >> title(‘Change of temperature with time’); Also paste the resultant figure in the Word file (select from the figure window: Edit .Copy Figure, then paste in your Word file), you should have

info@checkyourstudy.com Whatsapp +919911743277
In this circuit, V = 10 volts, R = 3,000 ohms, and C = 50 x 10-6 farads. The circuit has a time constant t, which depends on the resistance, R, and the capacitance, C, as t = R x C = 0.15 second. 1. Use a for loop. 2. Use the math library function exp(x) to compute ex. You will need to include the system header file math.h. 3. On Unix you will need –lm in your command line to tell the Linker to search the math library. 4. Use macro definition for all the constants. 5. Format the output so the output looks like the following. The time and voltage should display two digits after the decimal point.

In this circuit, V = 10 volts, R = 3,000 ohms, and C = 50 x 10-6 farads. The circuit has a time constant t, which depends on the resistance, R, and the capacitance, C, as t = R x C = 0.15 second. 1. Use a for loop. 2. Use the math library function exp(x) to compute ex. You will need to include the system header file math.h. 3. On Unix you will need –lm in your command line to tell the Linker to search the math library. 4. Use macro definition for all the constants. 5. Format the output so the output looks like the following. The time and voltage should display two digits after the decimal point.

info@checkyourstudy.com
EGR 140 Scientific Programming Assignment # 7 Spring 2017 Use MATLAB to solve each problem by writing script files; copy and paste the script file AND the results in the Command Window and/or plot in the Figure Window to a WORD document that has your name and section in the headers of each page and the page number in each footer. Edit the output to remove extra lines and empty spaces. The script files SHOULD have comments for easy readability; take a print out of the Word file and staple before submission. Due by 3 PM on April 11, 2017. Write a used-defined function that calculates the average and the standard deviation of a list of numbers. Use the function to calculate the average and the standard deviation of the following list of grades: 80 75 91 60 79 89 65 80 95 50 81 Note: The average x_ave (or mean) of a given set of n number x_1,x_2,…..,x_n is given by: x_ave=(x_1+x_2+x_3+⋯+x_n)/n The standard deviation is given by: σ=√((∑_(i=1)^(i=n)▒(x_i-x_ave )^2 )/(n-1)) DO not use built-in functions to calculate the mean and the standard deviation. Write a user-defined function that arranges the digits of a given (positive) number in a row vector in the same order as they appear in the number; the function should also arrange the digits in the decimal part in a different vector. For example, if the number is 2645.12, the vectors should be [2 6 4 5] and [1 2]. The whole number can be from 0 to 10 digits long and the decimal part 0 to 6. Check the validity of the function using a few numbers of your choice. A fenced enclosure consists of a rectangle of length L and width 2R, and a semicircle of radius R, as shown in Figure. The enclosure is to be built to have an area A of 1600 ft2. The cost of the fence is $40 per foot for the curved portion, and $30 per foot for the straight sides. Determine the values of R and L required to minimize the total cost of the fence and the minimum cost using calculus approach. A water tank consists of a cylindrical part of radius r and height h, and a hemispherical top. The tank is to be constructed to hold 500 meter3 of fluid when filled. The cost to construct the cylindrical part of the tank is $300 per square meter of the surface area; the hemispherical part costs $400 per square meter. Determine the radius that results in the least cost and compute the corresponding height and the cost using graphical approach. Verify your results using the calculus approach. A ceramic tile has the design shown in the figure. The shaded area is painted black and the rest of the tile is white. The border line between the red and the white areas follows the equation: y=Asin(x) Determine A such that the area of the white and black colors will be the same.

EGR 140 Scientific Programming Assignment # 7 Spring 2017 Use MATLAB to solve each problem by writing script files; copy and paste the script file AND the results in the Command Window and/or plot in the Figure Window to a WORD document that has your name and section in the headers of each page and the page number in each footer. Edit the output to remove extra lines and empty spaces. The script files SHOULD have comments for easy readability; take a print out of the Word file and staple before submission. Due by 3 PM on April 11, 2017. Write a used-defined function that calculates the average and the standard deviation of a list of numbers. Use the function to calculate the average and the standard deviation of the following list of grades: 80 75 91 60 79 89 65 80 95 50 81 Note: The average x_ave (or mean) of a given set of n number x_1,x_2,…..,x_n is given by: x_ave=(x_1+x_2+x_3+⋯+x_n)/n The standard deviation is given by: σ=√((∑_(i=1)^(i=n)▒(x_i-x_ave )^2 )/(n-1)) DO not use built-in functions to calculate the mean and the standard deviation. Write a user-defined function that arranges the digits of a given (positive) number in a row vector in the same order as they appear in the number; the function should also arrange the digits in the decimal part in a different vector. For example, if the number is 2645.12, the vectors should be [2 6 4 5] and [1 2]. The whole number can be from 0 to 10 digits long and the decimal part 0 to 6. Check the validity of the function using a few numbers of your choice. A fenced enclosure consists of a rectangle of length L and width 2R, and a semicircle of radius R, as shown in Figure. The enclosure is to be built to have an area A of 1600 ft2. The cost of the fence is $40 per foot for the curved portion, and $30 per foot for the straight sides. Determine the values of R and L required to minimize the total cost of the fence and the minimum cost using calculus approach. A water tank consists of a cylindrical part of radius r and height h, and a hemispherical top. The tank is to be constructed to hold 500 meter3 of fluid when filled. The cost to construct the cylindrical part of the tank is $300 per square meter of the surface area; the hemispherical part costs $400 per square meter. Determine the radius that results in the least cost and compute the corresponding height and the cost using graphical approach. Verify your results using the calculus approach. A ceramic tile has the design shown in the figure. The shaded area is painted black and the rest of the tile is white. The border line between the red and the white areas follows the equation: y=Asin(x) Determine A such that the area of the white and black colors will be the same.

checkyourstudy.com Whatsapp +919891515290
EEGR 221 MATLAB Project 1 Basic Signals Fall 2015 Due date: 10/5/15 1. (a) Plot ?1(?) = ?(?+1)−?(?−5) where -7 < t < 7 seconds. Use millisecond units. (b) Plot ? = 5 ??? (??)[ ?(?+1)−?(?−5)] 2. (a) Plot x2(t) exactly as shown in this figure. Include the same titles and labels for the signal. Hint: Find the amplitude equations as function of time and insert those to your MATLAB script to create and plot this signal. (b) Decompose x2(t) into its even and odd components and plot x2e(t) and x2o(t). (c) Plot x2e(t) + x2o(t) and verify that x2e(t) + x2o(t) = x2(t). How to report the results?  For each plot you must label x and y axis and have a title for the plot. Following commands could be used. heaviside, plot, axis, ylabel, ylabel, title, fliplr, etc … At the command prompt of MATLAB you can type >> help [command name] to get help with any command.  Plot all of the signal for t between -7 and 7 seconds.  Save your commands in an m-file with your name in the name field. (e.g. John_Scott.m) and append the code to the end of your report.  Your report must be organized and your solution for each question mu st be clearly marked by the number of the question. Example 2.a or 2.b, … In each part the problem should be clearly identified. Type the problem statement in each section. Show the plots of input and output signals. Draw conclusions based on your plots and in problem 3 discuss why the property is not satisfied based on your plots.  Turn in a hard copy of your report in class. This report must include a cover page with the name of both student partners.

EEGR 221 MATLAB Project 1 Basic Signals Fall 2015 Due date: 10/5/15 1. (a) Plot ?1(?) = ?(?+1)−?(?−5) where -7 < t < 7 seconds. Use millisecond units. (b) Plot ? = 5 ??? (??)[ ?(?+1)−?(?−5)] 2. (a) Plot x2(t) exactly as shown in this figure. Include the same titles and labels for the signal. Hint: Find the amplitude equations as function of time and insert those to your MATLAB script to create and plot this signal. (b) Decompose x2(t) into its even and odd components and plot x2e(t) and x2o(t). (c) Plot x2e(t) + x2o(t) and verify that x2e(t) + x2o(t) = x2(t). How to report the results?  For each plot you must label x and y axis and have a title for the plot. Following commands could be used. heaviside, plot, axis, ylabel, ylabel, title, fliplr, etc … At the command prompt of MATLAB you can type >> help [command name] to get help with any command.  Plot all of the signal for t between -7 and 7 seconds.  Save your commands in an m-file with your name in the name field. (e.g. John_Scott.m) and append the code to the end of your report.  Your report must be organized and your solution for each question mu st be clearly marked by the number of the question. Example 2.a or 2.b, … In each part the problem should be clearly identified. Type the problem statement in each section. Show the plots of input and output signals. Draw conclusions based on your plots and in problem 3 discuss why the property is not satisfied based on your plots.  Turn in a hard copy of your report in class. This report must include a cover page with the name of both student partners.

1 IN2009: Language Processors Coursework Part 3: The Interpreter Introduction This is the 3rd and final part of the coursework. In the second part of the coursework you created a parser for the Moopl grammar which, given a syntactically correct Moopl program as input, builds an AST representation of the program. In Part 3 you will develop an interpreter which executes Moopl programs by visiting their AST representations. For this part of the coursework we provide functional code (with limitations, see below) for parsing, building a symbol table, type checking and variable allocation. Marks This part of the coursework is worth 12 of the 30 coursework marks for the Language Processors module. This part of the coursework is marked out of 12. Submission deadline This part of the coursework should be handed in before 5pm on Sunday 9th April 2017. In line with school policy, late submissions will be awarded no marks. Return & Feedback Marks and feedback will be available as soon as possible, certainly on or before Wed 3rd May 2017. Plagiarism If you copy the work of others (either that of fellow students or of a third party), with or without their permission, you will score no marks and further disciplinary action will be taken against you. Group working You will be working in the same groups as for the previous parts of the coursework except where group changes have already been approved. Submission: Submit a zip archive (not a rar file) of all your source code (the src folder of your project). We do not want the other parts of your NetBeans project, only the source code. Note 1: Submissions which do not compile will get zero marks. Note 2: You must not change the names or types of any of the existing packages, classes or public methods. 2 Getting started Download either moopl-interp.zip or moopl-interp.tgz from Moodle and extract all files. Key contents to be aware of: • A fully implemented Moopl parser (also implements a parser for the interpreter command language; see below). • A partially implemented Moopl type checker. • Test harnesses for the type checker and interpreter. • A directory of a few example Moopl programs (see Testing below). • Folder interp containing prototype interpreter code. The type-checker is only partially implemented but a more complete implementation will be provided following Session 6. That version is still not fully complete because it doesn’t support inheritance. Part d) below asks you to remove this restriction. The VarAllocator visitor in the interp package uses a simple implementation which only works for methods in which all parameter and local variable names are different. Part e) below asks you to remove this restriction. The three parts below should be attempted in sequence. When you have completed one part you should make a back-up copy of the work and keep it safe, in case you break it in your attempt at the next part. Be sure to test old functionality as well as new (regression testing). We will not assess multiple versions so, if your attempt at part d) or e) breaks previously working code, you may gain a better mark by submitting the earlier version for assessment. c) [8 marks] The Basic Interpreter: complete the implementation of the Interpreter visitor in the interp package. d) [2 marks] Inheritance: extend the type-checker, variable allocator and interpreter to support inheritance. e) [2 marks] Variable Allocation: extend the variable allocator to fully support blockstructure and lexical scoping, removing the requirement that all parameter and local variable names are different. Aim to minimise the number of local variable slots allocated in a stack frame. Note: variable and parameter names declared at the same scope level are still required to be different from each other (a method cannot have two different parameters called x, for example) and this is enforced by the existing typechecking code. But variables declared in different blocks (even when nested) can have the same name. Exceptions Your interpreter will only ever be run on Moopl code which is type-correct (and free from uninitialised local variables). But it is still possible that the Moopl code contains logical errors which may cause runtime errors (such as null-reference or array-bound errors). Your interpreter should throw a MooplRunTimeException with an appropriate error message in these cases. The only kind of exception your interpreter should ever throw is a MooplRunTimeException. 3 Testing The examples folder does not contain a comprehensive test-suite. You need to invent and run your own tests. The document Moopl compared with Java gives a concise summary of how Moopl programs are supposed to behave. You can (and should) also compare the behaviour of your interpreter with that of the online tool: https://smcse.city.ac.uk/student/sj353/langproc/Moopl.html (Note: the online tool checks for uninitialised local variables. Your implementation is not expected to do this.) To test your work, run the top-level Interpret harness, providing the name of a Moopl source file as a command-line argument. When run on a type-correct Moopl source file, Interpret will pretty-print the Moopl program then display a command prompt (>) at which you can enter one of the following commands: :quit This will quit the interpreter. :call main() This will call the top-level proc main, interpreted in the context defined by the Moopl program. (Any top-level proc can be called this way). :eval Exp ; This will evaluate expression Exp, interpreted in the context defined by the Moopl program, and print the result. Note the required terminating semi-colon. Testing your Expression visitors To unit-test your Exp visit methods, run the top-level Interpret harness on a complete Moopl program (though it can be trivial) and use the :eval command. For example, to test your visit methods for the Boolean-literals (ExpTrue and ExpFalse), you would enter the commands > :eval true ; > :eval false ; which should output 1 and 0, respectively. For the most basic cases, the Moopl program is essentially irrelevant (a single top-level proc with empty body may be sufficient). For other cases you will need to write programs containing class definitions (in order, for example, to test object creation and method call). Testing your Statement visitors To unit-test your Stm visit methods, write very simple Moopl programs, each with a top-level proc main() containing just a few lines of code. Run the top-level Interpret harness on these simple programs and enter the command > :call main() You will find a few examples to get you started in the folder examples/unittests. As for the Exp tests, simple cases can be tested using Moopl programs with just a main proc but for the more complex tests you will need to write Moopl programs containing class definitions. 4 Grading criteria Solutions will be graded according to their functional correctness, and the elegance of their implementation. Below are criteria that guide the award of marks. 70 – 100 [1st class] Work that meets all the requirements in full, constructed and presented to a professional standard. Showing evidence of independent reading, thinking and analysis. 60 – 69 [2:1] Work that makes a good attempt to address the requirements, realising all to some extent and most well. Well-structured and well presented. 50 – 59 [2:2] Work that attempts to address requirements realising all to some extent and some well but perhaps also including irrelevant or underdeveloped material. Structure and presentation may not always be clear. 40 – 49 [3rd class] Work that attempts to address the requirements but only realises them to some extent and may not include important elements or be completely accurate. Structure and presentation may lack clarity. 0 – 39 [fail] Unsatisfactory work that does not adequately address the requirements. Structure and presentation may be confused or incoherent.

1 IN2009: Language Processors Coursework Part 3: The Interpreter Introduction This is the 3rd and final part of the coursework. In the second part of the coursework you created a parser for the Moopl grammar which, given a syntactically correct Moopl program as input, builds an AST representation of the program. In Part 3 you will develop an interpreter which executes Moopl programs by visiting their AST representations. For this part of the coursework we provide functional code (with limitations, see below) for parsing, building a symbol table, type checking and variable allocation. Marks This part of the coursework is worth 12 of the 30 coursework marks for the Language Processors module. This part of the coursework is marked out of 12. Submission deadline This part of the coursework should be handed in before 5pm on Sunday 9th April 2017. In line with school policy, late submissions will be awarded no marks. Return & Feedback Marks and feedback will be available as soon as possible, certainly on or before Wed 3rd May 2017. Plagiarism If you copy the work of others (either that of fellow students or of a third party), with or without their permission, you will score no marks and further disciplinary action will be taken against you. Group working You will be working in the same groups as for the previous parts of the coursework except where group changes have already been approved. Submission: Submit a zip archive (not a rar file) of all your source code (the src folder of your project). We do not want the other parts of your NetBeans project, only the source code. Note 1: Submissions which do not compile will get zero marks. Note 2: You must not change the names or types of any of the existing packages, classes or public methods. 2 Getting started Download either moopl-interp.zip or moopl-interp.tgz from Moodle and extract all files. Key contents to be aware of: • A fully implemented Moopl parser (also implements a parser for the interpreter command language; see below). • A partially implemented Moopl type checker. • Test harnesses for the type checker and interpreter. • A directory of a few example Moopl programs (see Testing below). • Folder interp containing prototype interpreter code. The type-checker is only partially implemented but a more complete implementation will be provided following Session 6. That version is still not fully complete because it doesn’t support inheritance. Part d) below asks you to remove this restriction. The VarAllocator visitor in the interp package uses a simple implementation which only works for methods in which all parameter and local variable names are different. Part e) below asks you to remove this restriction. The three parts below should be attempted in sequence. When you have completed one part you should make a back-up copy of the work and keep it safe, in case you break it in your attempt at the next part. Be sure to test old functionality as well as new (regression testing). We will not assess multiple versions so, if your attempt at part d) or e) breaks previously working code, you may gain a better mark by submitting the earlier version for assessment. c) [8 marks] The Basic Interpreter: complete the implementation of the Interpreter visitor in the interp package. d) [2 marks] Inheritance: extend the type-checker, variable allocator and interpreter to support inheritance. e) [2 marks] Variable Allocation: extend the variable allocator to fully support blockstructure and lexical scoping, removing the requirement that all parameter and local variable names are different. Aim to minimise the number of local variable slots allocated in a stack frame. Note: variable and parameter names declared at the same scope level are still required to be different from each other (a method cannot have two different parameters called x, for example) and this is enforced by the existing typechecking code. But variables declared in different blocks (even when nested) can have the same name. Exceptions Your interpreter will only ever be run on Moopl code which is type-correct (and free from uninitialised local variables). But it is still possible that the Moopl code contains logical errors which may cause runtime errors (such as null-reference or array-bound errors). Your interpreter should throw a MooplRunTimeException with an appropriate error message in these cases. The only kind of exception your interpreter should ever throw is a MooplRunTimeException. 3 Testing The examples folder does not contain a comprehensive test-suite. You need to invent and run your own tests. The document Moopl compared with Java gives a concise summary of how Moopl programs are supposed to behave. You can (and should) also compare the behaviour of your interpreter with that of the online tool: https://smcse.city.ac.uk/student/sj353/langproc/Moopl.html (Note: the online tool checks for uninitialised local variables. Your implementation is not expected to do this.) To test your work, run the top-level Interpret harness, providing the name of a Moopl source file as a command-line argument. When run on a type-correct Moopl source file, Interpret will pretty-print the Moopl program then display a command prompt (>) at which you can enter one of the following commands: :quit This will quit the interpreter. :call main() This will call the top-level proc main, interpreted in the context defined by the Moopl program. (Any top-level proc can be called this way). :eval Exp ; This will evaluate expression Exp, interpreted in the context defined by the Moopl program, and print the result. Note the required terminating semi-colon. Testing your Expression visitors To unit-test your Exp visit methods, run the top-level Interpret harness on a complete Moopl program (though it can be trivial) and use the :eval command. For example, to test your visit methods for the Boolean-literals (ExpTrue and ExpFalse), you would enter the commands > :eval true ; > :eval false ; which should output 1 and 0, respectively. For the most basic cases, the Moopl program is essentially irrelevant (a single top-level proc with empty body may be sufficient). For other cases you will need to write programs containing class definitions (in order, for example, to test object creation and method call). Testing your Statement visitors To unit-test your Stm visit methods, write very simple Moopl programs, each with a top-level proc main() containing just a few lines of code. Run the top-level Interpret harness on these simple programs and enter the command > :call main() You will find a few examples to get you started in the folder examples/unittests. As for the Exp tests, simple cases can be tested using Moopl programs with just a main proc but for the more complex tests you will need to write Moopl programs containing class definitions. 4 Grading criteria Solutions will be graded according to their functional correctness, and the elegance of their implementation. Below are criteria that guide the award of marks. 70 – 100 [1st class] Work that meets all the requirements in full, constructed and presented to a professional standard. Showing evidence of independent reading, thinking and analysis. 60 – 69 [2:1] Work that makes a good attempt to address the requirements, realising all to some extent and most well. Well-structured and well presented. 50 – 59 [2:2] Work that attempts to address requirements realising all to some extent and some well but perhaps also including irrelevant or underdeveloped material. Structure and presentation may not always be clear. 40 – 49 [3rd class] Work that attempts to address the requirements but only realises them to some extent and may not include important elements or be completely accurate. Structure and presentation may lack clarity. 0 – 39 [fail] Unsatisfactory work that does not adequately address the requirements. Structure and presentation may be confused or incoherent.

checkyourstudy.com Whatsapp +919911743277
PlotCycloidArc(8.5) Math98 HW4 The cylcoid is the plane curve traced out by a point on a circle as the circle rolls without slipping on a straight line.1 In this exercise we will use MATLAB to create an animation of a circle rolling on a straight line, while a point on the circle traces the cycloid. a. Implement a MATLAB function of the form function PlotCycloidArc(ArcLength). This function takes in a positive number ArcLength and displays a snapshot of the cirle rolling (without slipping) on the x-axis while a point on the cirlce traces the cycloid. The circle is initially centered at (0,1) and has radius 1, and the initial tracing point is taken to be (0, 0). An example output is shown in the above ?gure. As in the ?gure, plot the cycloid arc black, the circle blue, and use a red dot for the tracing point. Hint: If the circle has rolled for a length of arc t = 0, the coordinates of the tracing point are (t-sin t, 1-cos t). b. Implement a MATLAB function of the form function CycloidMovie(NumHumps,NumIntervals). This function will output an animation of the circle rolling along a line while a point on the circle traces the cycloid. This function inputs two natural numbers NumHumps and NumIntervals representing the number of periods (or humps) of the cycloid and the number or frames per hump that will be used to make the animation, respectively. Use the getframe command to save frames outputted from PlotCycloidArc and the movie command to play them back together as a movie. Use the axis command to view the frames on the rectan- gle [0, 2pNumHumps] × [0, 5/2]. Also label the ticks 0, 2p, . . . , 2pNumHumps on the x axis with the strings 1See Wikipedia for more on the cycloid. 0, 2p, . . . , 2pNumHumps and do the same for 1, 2 on the y axis (see the ?gure above). Label the movie ’Cycloid Animation’. Submit MATLAB code for both parts a and b and a printout the ?gures obtained by the commands PlotCycloidArc(8.5), PlotCycloidArc(12), and CycloidMovie(3,10)

PlotCycloidArc(8.5) Math98 HW4 The cylcoid is the plane curve traced out by a point on a circle as the circle rolls without slipping on a straight line.1 In this exercise we will use MATLAB to create an animation of a circle rolling on a straight line, while a point on the circle traces the cycloid. a. Implement a MATLAB function of the form function PlotCycloidArc(ArcLength). This function takes in a positive number ArcLength and displays a snapshot of the cirle rolling (without slipping) on the x-axis while a point on the cirlce traces the cycloid. The circle is initially centered at (0,1) and has radius 1, and the initial tracing point is taken to be (0, 0). An example output is shown in the above ?gure. As in the ?gure, plot the cycloid arc black, the circle blue, and use a red dot for the tracing point. Hint: If the circle has rolled for a length of arc t = 0, the coordinates of the tracing point are (t-sin t, 1-cos t). b. Implement a MATLAB function of the form function CycloidMovie(NumHumps,NumIntervals). This function will output an animation of the circle rolling along a line while a point on the circle traces the cycloid. This function inputs two natural numbers NumHumps and NumIntervals representing the number of periods (or humps) of the cycloid and the number or frames per hump that will be used to make the animation, respectively. Use the getframe command to save frames outputted from PlotCycloidArc and the movie command to play them back together as a movie. Use the axis command to view the frames on the rectan- gle [0, 2pNumHumps] × [0, 5/2]. Also label the ticks 0, 2p, . . . , 2pNumHumps on the x axis with the strings 1See Wikipedia for more on the cycloid. 0, 2p, . . . , 2pNumHumps and do the same for 1, 2 on the y axis (see the ?gure above). Label the movie ’Cycloid Animation’. Submit MATLAB code for both parts a and b and a printout the ?gures obtained by the commands PlotCycloidArc(8.5), PlotCycloidArc(12), and CycloidMovie(3,10)

info@checkyourstudy.com Operations Team Whatsapp( +91 9911743277)
Biomedical Signal and Image Processing (4800_420_001) Assigned on September 12th, 2017 Assignment 4 – Noise and Correlation 1. If a signal is measured as 2.5 V and the noise is 28 mV (28 × 10−3 V), what is the SNR in dB? 2. A single sinusoidal signal is found with some noise. If the RMS value of the noise is 0.5 V and the SNR is 10 dB, what is the RMS amplitude of the sinusoid? 3. The file signal_noise.mat contains a variable x that consists of a 1.0-V peak sinusoidal signal buried in noise. What is the SNR for this signal and noise? Assume that the noise RMS is much greater than the signal RMS. Note: “signal_noise.mat” and other files used in these assignments can be downloaded from the content area of Brightspace, within the “Data Files for Exercises” folder. These files can be opened in Matlab by copying into the active folder and double-clicking on the file or using the Matlab load command using the format: load(‘signal_noise.mat’). To discover the variables within the files use the Matlab who command. 4. An 8-bit ADC converter that has an input range of ±5 V is used to convert a signal that ranges between ±2 V. What is the SNR of the input if the input noise equals the quantization noise of the converter? Hint: Refer to Equation below to find the quantization noise: 5. The file filter1.mat contains the spectrum of a fourth-order lowpass filter as variable x in dB. The file also contains the corresponding frequencies of x in variable freq. Plot the spectrum of this filter both as dB versus log frequency and as linear amplitude versus linear frequency. The frequency axis should range between 10 and 400 Hz in both plots. Hint: Use Equation below to convert: Biomedical Signal and Image Processing (4800_420_001) Assigned on September 12th, 2017 6. Generate one cycle of the square wave similar to the one shown below in a 500-point MATLAB array. Determine the RMS value of this waveform. [Hint: When you take the square of the data array, be sure to use a period before the up arrow so that MATLAB does the squaring point-by-point (i.e., x.^2).]. 7. A resistor produces 10 μV noise (i.e., 10 × 10−6 V noise) when the room temperature is 310 K and the bandwidth is 1 kHz (i.e., 1000 Hz). What current noise would be produced by this resistor? 8. A 3-ma current flows through both a diode (i.e., a semiconductor) and a 20,000-Ω (i.e., 20-kΩ) resistor. What is the net current noise, in? Assume a bandwidth of 1 kHz (i.e., 1 × 103 Hz). Which of the two components is responsible for producing the most noise? 9. Determine if the two signals, x and y, in file correl1.mat are correlated by checking the angle between them. 10. Modify the approach used in Practice Problem 3 to find the angle between short signals: Do not attempt to plot these vectors as it would require a 6-dimensional plot!

Biomedical Signal and Image Processing (4800_420_001) Assigned on September 12th, 2017 Assignment 4 – Noise and Correlation 1. If a signal is measured as 2.5 V and the noise is 28 mV (28 × 10−3 V), what is the SNR in dB? 2. A single sinusoidal signal is found with some noise. If the RMS value of the noise is 0.5 V and the SNR is 10 dB, what is the RMS amplitude of the sinusoid? 3. The file signal_noise.mat contains a variable x that consists of a 1.0-V peak sinusoidal signal buried in noise. What is the SNR for this signal and noise? Assume that the noise RMS is much greater than the signal RMS. Note: “signal_noise.mat” and other files used in these assignments can be downloaded from the content area of Brightspace, within the “Data Files for Exercises” folder. These files can be opened in Matlab by copying into the active folder and double-clicking on the file or using the Matlab load command using the format: load(‘signal_noise.mat’). To discover the variables within the files use the Matlab who command. 4. An 8-bit ADC converter that has an input range of ±5 V is used to convert a signal that ranges between ±2 V. What is the SNR of the input if the input noise equals the quantization noise of the converter? Hint: Refer to Equation below to find the quantization noise: 5. The file filter1.mat contains the spectrum of a fourth-order lowpass filter as variable x in dB. The file also contains the corresponding frequencies of x in variable freq. Plot the spectrum of this filter both as dB versus log frequency and as linear amplitude versus linear frequency. The frequency axis should range between 10 and 400 Hz in both plots. Hint: Use Equation below to convert: Biomedical Signal and Image Processing (4800_420_001) Assigned on September 12th, 2017 6. Generate one cycle of the square wave similar to the one shown below in a 500-point MATLAB array. Determine the RMS value of this waveform. [Hint: When you take the square of the data array, be sure to use a period before the up arrow so that MATLAB does the squaring point-by-point (i.e., x.^2).]. 7. A resistor produces 10 μV noise (i.e., 10 × 10−6 V noise) when the room temperature is 310 K and the bandwidth is 1 kHz (i.e., 1000 Hz). What current noise would be produced by this resistor? 8. A 3-ma current flows through both a diode (i.e., a semiconductor) and a 20,000-Ω (i.e., 20-kΩ) resistor. What is the net current noise, in? Assume a bandwidth of 1 kHz (i.e., 1 × 103 Hz). Which of the two components is responsible for producing the most noise? 9. Determine if the two signals, x and y, in file correl1.mat are correlated by checking the angle between them. 10. Modify the approach used in Practice Problem 3 to find the angle between short signals: Do not attempt to plot these vectors as it would require a 6-dimensional plot!

Whatsapp +919911743277