In this assignment you will be modelling a series RLC Resist
Solution
Main Program(Main_Prog_RLC.m):
clc
close all;
R = input(\'Enter the value of Resistance:\');
L = input(\'Enter the value of Inductance:\');
C = input(\'Enter the value of Capacitance:\');
tinc = input(\'Enter the change in Time-period:\');
n = input(\'Enter the no. of iterations:\');
i= input(\'Enter the initial value of I:\');
j=input(\'Enter the initial value of J:\');
[I,J] = RLC(R,L,C,tinc,n,i,j);
disp(\'The values of I(n) are:\');
disp(I);
disp(\'The values of J(n) are:\');
disp(J);
Function Program(RLC.m):
% Creating a function program \"RLC\" for calculation of currents and change
% in curretns
function [I,J] = RLC(R,L,C,tinc,n,i,j)
for p=2:n
I(1)=i; % Initial current value from user input
J(1)=j; % Initial change in current value from user input
J(p)=J(p-1)-(tinc/L)*(R*J(p-1)+(1/C)*I(p-1)); % difference equations given in queston
I(p)=I(p-1)+J(p)*tinc; % difference equations given in queston
end
