MatLab Programming:-
%% Main File
clc;
clear all;
close all;
[t,x]=ode45(@rlcckt,[0 1],[0 0]); plot(t,x(:,1),'m'); hold on plot(t,x(:,2),'b'); legend('x1','x2'); %% Function File
function dx=rlcckt(t,x) dx = zeros(2,1); Vin=5; R=5; C=10; L=0.5; dx(1)=x(2); dx(2)=(Vin/L)-((R/L)*x(2))-((1/L*C)*x(1));end
Best Answer