Question: 2. Practicum -- Logical Arrays and Plotting A Matrix is a 2-D Array that is typically used in Linear Algebra applications Please: Create an m-file
2. Practicum -- Logical Arrays and Plotting
A Matrix is a 2-D Array that is typically used in Linear Algebra applications
Please:
-
Create an m-file called half_wave.m in Octave-Online or MATLAB.
-
Copy the Starter code from the below into your .m file
-
Solve the problem according to the description
6.17 Practicum - Diode Rectifier
For this problem, consider the "half-wave" rectifier circuit consisting of an ideal diode and a resistor. This circuit takes an input sinusoidal waveform Vin and produces a "rectified" waveform Vout such that Vout = Vin wherever Vin > 0 and Vout = 0 everywhere else.
Following the instructions below, use MATLAB's relational and logical operators to construct the following plot (use the subplot command to stack the two curves vertically).
Use the following pseudocode to develop your solution in a SCRIPT file called half_wave.m:
-
Create a time vector t ranging from 0 to 10 seconds (make sure you have at least 200 points)
-
Create a voltage vector Vin defined as Vin = 100sin(2t)
-
Create voltage vector Vout as a copy of Vin.
The relational and logical operators can be also be used to modify the values in an array. For example, suppose X = [1, 9, 25, 49, 81]
The following statements show how you can set the values of X that are larger than 40 equal to 40, so that the modified data set "tops out" at 40.
Xgt40 = X>40 % Xgt40 = 0 0 0 1 1
X(Xgt40) = 40 % now X = 1 9 25 40 40
-
Modify your voltage vector Vout using the techniques above so that the Vout vector "bottoms out" at 0.
-
Create a 2 row by 1 column subplot grid and plot the input voltage as a function of time on the top plot, and the output voltage as a function of time on the bottom plot.
Enter your code for half_wave.m here:
| Paste code here |
Enter your final plot here:
| Paste your plot here |
-
When you have a solution, please:
-
a) copy and paste your solution code on top of the start code provided
-
b) copy and paste your plot image into the space provided below the code window..
-
-
Print this doc (only the pages containing your code and plot image) to pdf
-
Submit the pdf as your Practicum solution to Canvas.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
