Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

ENG1014 - Engineering Numerical Analysis - S1_2023


Information

 

 

In electronicsa 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 or -1.

i.e. for a square wave with a period of 2π:

 

Question 33

Not yet

answered

Marked out of

11.00

 

 

 

 

 

Question 34

Not yet

answered

Marked out of

11.00

 


Write a Matlab function called "squarewave_approxthat

  takes 2 inputsa 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 simplied 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 graphwhich shows the approximation for both nmax = 3 and nmax = 19, using a domain of x = [0,4π] with a resolution of 0.01.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Question 35

Not yet

answered

Marked out of

2.00


 

Question 36

Not yet

answered

Marked out of

2.00

 


Write a script that will call your function from the previous questionand then create the graph exactly as it appears in the image, including all labelling and formatting.

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.

 

 

 

 

 

 

 

clear all;close all;clc;

xmin = 0;

xmax = 4*pi;

resolution = 0.01;

 

                                                                                                                                                                                                                                                                                                                    

Path: style


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