Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. A discrete hands-on ezercise, part 1. In HW 6, problem 1, you have shown why the discrete linear system governed by the difference equation
1. A discrete hands-on ezercise, part 1. In HW 6, problem 1, you have shown why the discrete linear system governed by the difference equation with initial conditions should respond to the input with the output vini-um(-23 + 105(2)"-56(2)" (4)"} 439 (4) 6302 for n 0. Now, program and run eqn. (1) on your computer. That is, code a loop over n2, -1,0,1,2, 3,4,5,6,.., the loop to calculate yfn + 2] during each iteration. Use the already-known values of yln 1] and y[n], calculated during earlier iterations, to calculate y[n+2]. Submit your code with appropriate comments. Output z[n] and y[n], tabulated against n, for -2n 15 (that is, if you prefer, output y[n + 2] for -4 n S 13) Format and columniate the floating-point output as -0.039815, printing six places after the decimal point.1 You may use any standard programming language such as C, C++, Objec- tive C, Fortran, Python, Perl, Java, Octave/Matlab, R, OCaml, Haskell, 1 In C, something like printf("%10.6f ", foo); where foo is the floating-point variable whose value is to be printed, should do the job. This works in C++, too, except that for proper C++ style one should write the printfO as atd: :printf). It works in Octave as well and, as far as the instructor knows, in Matlab. Indeed, it works in several programming languages. In the format string, the 10 says to use no fewer than ten columns and the 6 says to print six places after the point. In C, you'll need to #include . In C++.*include 1. A discrete hands-on ezercise, part 1. In HW 6, problem 1, you have shown why the discrete linear system governed by the difference equation with initial conditions should respond to the input with the output vini-um(-23 + 105(2)"-56(2)" (4)"} 439 (4) 6302 for n 0. Now, program and run eqn. (1) on your computer. That is, code a loop over n2, -1,0,1,2, 3,4,5,6,.., the loop to calculate yfn + 2] during each iteration. Use the already-known values of yln 1] and y[n], calculated during earlier iterations, to calculate y[n+2]. Submit your code with appropriate comments. Output z[n] and y[n], tabulated against n, for -2n 15 (that is, if you prefer, output y[n + 2] for -4 n S 13) Format and columniate the floating-point output as -0.039815, printing six places after the decimal point.1 You may use any standard programming language such as C, C++, Objec- tive C, Fortran, Python, Perl, Java, Octave/Matlab, R, OCaml, Haskell, 1 In C, something like printf("%10.6f ", foo); where foo is the floating-point variable whose value is to be printed, should do the job. This works in C++, too, except that for proper C++ style one should write the printfO as atd: :printf). It works in Octave as well and, as far as the instructor knows, in Matlab. Indeed, it works in several programming languages. In the format string, the 10 says to use no fewer than ten columns and the 6 says to print six places after the point. In C, you'll need to #include . In C++.*include
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started