(Solved):
1. The Voltage and Current relationship for a resistor is given by the following equation: Write a ...
1. The Voltage and Current relationship for a resistor is given by the following equation: Write a MATLAB program that plots \( v(t) \) and \( i(t) \) between \( t=0 \) and \( t=2 \pi \) on the same axes. 2. The Voltage and Current relationship for \( a \) inductor is given by the following equation: \( v(t)=L \frac{d i(t)}{d t} \), where \( L=0.6 H \) and \( i(t)=\cos (5 t+\pi / 2) A \). Write a MATLAB program that plots \( v(t) \) and \( i(t) \) between \( t=0 \) and \( t=2 \pi \) on the same axes. (Do not use any function for the derivative in MATLAB, manually find the derivative of the current and use it in the equation). 3. The Voltage and Current relationship for a capacitor is given by the following equation: Write a MATLAB program that plots \( v(t) \) and \( i(t) \) between \( t=0 \) and \( t=2 \pi \) on the same axes. (Do not use any function for the derivative in MATLAB, manually find the derivative of the voltage and use it in the equation). 4. Create a 10x10 matrix with random numbers using rand function in MATLAB. Write the MATLAB commands to do the following: a. Using for loops, write the code to find the sum and average of matrix elements whose values are between \( 0.3 \) and \( 0.6 \). b. Without using for loops, repeat part (a) using logical arrays and vectorized code. You can use sum and mean built-in functions.
(1) R = 2 Ohm i(t) = cos(5t + /2) A v(t) = i(t) R = 2 cos(5t + /2) V. MATLAB code and the resulting graph are given below. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% R = 2; % Given resistance value % Time vector t = 0:1e-3:2*pi; i = cos(5*t+pi/2); v = i*R; % pl