Question 2 40 pts Below is a matlab function (name it solvecircuit.m). This func
ID: 2292927 • Letter: Q
Question
Question 2 40 pts Below is a matlab function (name it solvecircuit.m). This function is supposed to calculate the current corresponding to a sinusoidal voltage source put across the parallel combination of a resistor, inductor and capacitor. However, there is an error in the function Correct the error in the function and then run the function with the following input: Vin is 10 V at 0 degrees of phase, the frequency in radians is 1000, the resistance value is 1 ?, the capacitance value is 2 mF, and the inductance value is 2 mH. Specify the relative phase of the current in degrees to two decimal places function [lout, Imag, Iphase] solvecircuit(Vin,w,R0,CL,LZ) = 2. Iout - Vin/Zp; 3. Imag = abs(lout); 4 Iphase angle(Iout); 5. lphase=1phase*180/pi;Explanation / Answer
%Main file MATLAB CODE
clc;
clear all;
close all;
Vin=10;
W=1000;
R0=1;
C1=2e-3;
L2=2e-3;
[Iout,Imag,Iphase]=solvecircuit(Vin,W,R0,C1,L2);
%function file MATLAB code solvecircuit.m
%Formulae for calculation of current should be changed
function[Iout,Imag,Iphase]=solvecircuit(Vin,W,R0,C1,L2)
Zp=(1/R0 + 1j*W*C1 +1/(1j*W*L2)); %this is admittance
Iout=Vin*Zp; %current will be product of voltage and admittance
Imag=abs(Iout);
Iphase=angle(Iout);
Iphase=Iphase*180/pi;
fprintf('imaginary part of Iout is %f',Imag);
fprintf(' phase of Iout is %f' ,Iphase);
OUTPUT:
imaginary part of Iout is 18.027756
phase of Iout is 56.309932
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.