ENG1014 - Engineering Numerical Analysis - S1_2023 Question 33-36
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
ENG1014 - Engineering Numerical Analysis - S1_2023
|
In electronics, a square wave signal can be generated by the equation: where the period of the square wave is 2L, and f(x) has values of either 1 or -1. i.e. for a square wave with a period of 2π: |
|||||
|
||||||
|
Write a Matlab function called "squarewave_approx" that takes 2 inputs: a vector "x" and a number "nmax". produces a vector output, "f_x", which is the values off(x) calculated for all values in x. f(x) is the square wave approximation that uses all terms with n ≤ nmax. f(x) has a period of 2π, and values that approach either -1 or 1 (i.e. you can use the simplified equation above) You must use a loop andan anonymous function within your function. Copy/paste the entire contents of the function file into the textbox below
You wish to produce the following graph, which shows the approximation for both nmax = 3 and nmax = 19, using a domain of x = [0,4π] with a resolution of 0.01.
|
|
You may use the pre-written text to begin your script if you wish. If you could not complete the previous question, the data required for the graph is available here.You may use this to earn consequential marks. (note: you must be logged into google with your Monash ID) Copy and paste your script into the textbox below.
You are working in an application that needs an accurate square wave signal. If the magnitude signal is more than 10% below the desired signal (i.e. greater than -0.9 or less than 0.9), it causes problems. Calculate what percentage of the time this will occur for the approximation with nmax = 19. Give your answer as a percentage to 2 decimal places. Answer:
Copy/paste your code for the previous question into the text box
|
2023-08-07