Write a MATLAB function and test bench script code to solve the above simple RL/RC circuits by following the instructions noted below. The input signal and impulse response generation should be done in the function. The test bench script should be used only to call the function and for signal plotting purposes. No plotting should be done inside the function itself. Name your function L2_C
Instructions: Input voltage ,x(t), can be AC or DC. Consider a variable ‘w1’ which can have value 0 or 1. If w1 is 0, the input is DC as shown in Figure 4(a) and if w1 is 1, the input is AC as shown in Figure 4(b). Let A be the amplitude of the input. Use ‘if’ statement to obtain the input voltage depending on the value of w1. Use another variable ‘w2’ which can also be either 0 or 1. If w2 is 0, it means RL circuit is being analyzed and if it is 1, RC circuit is being analyzed. For each system, the impulse response and output voltages are provided above. Use ‘if’ statement to obtain h(t) and y(t) for RL/RC circuit depending on the values of w2. Let your function have 7 input parameters: dt, w1, w2, A, R, L, C. dt is the step size for representing continuous signals. w1 and w2 are as specified above. A is the amplitude of the input voltage, R is the resistance value in ohms, L the inductance value in Henry and C the capacitance value in Farad. Your function need to have 3 outputs: x, h and y, where x is the input voltage, h the impulse response and y the output voltage. Verify your function by plotting the outputs of your function in the test bench. Analyze and report how your output changes when the resistance value is changed from 0.1 to 1 ohms for both RL and RC circuits. You can fix the values of C and L to 1 Farad and 1 Henry, respectively.
Get Answers For Free
Most questions answered within 1 hours.