0% found this document useful (0 votes)
12 views

International Islamic University, Islamabad: Lab Experiment

This document contains the report of a lab experiment conducted at the International Islamic University, Islamabad. It includes the date the experiment was conducted, the date the report was submitted, and spaces for the marks obtained and instructor's remarks and signature. The body of the report describes the steps and solutions to three different circuit simulations: 1) a mass-spring system, 2) an RC circuit, and 3) an RLC circuit. For each, it provides the relevant equations, initial conditions, and code to run the simulation in MATLAB and Simulink.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

International Islamic University, Islamabad: Lab Experiment

This document contains the report of a lab experiment conducted at the International Islamic University, Islamabad. It includes the date the experiment was conducted, the date the report was submitted, and spaces for the marks obtained and instructor's remarks and signature. The body of the report describes the steps and solutions to three different circuit simulations: 1) a mass-spring system, 2) an RC circuit, and 3) an RLC circuit. For each, it provides the relevant equations, initial conditions, and code to run the simulation in MATLAB and Simulink.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

International Islamic University, Islamabad

LAB EXPERIMENT
Date of Experiment:
Report submitted on:

Marks obtained:
Remarks: .
Instructors Signature:

SOLUTION:
STEP(1)

function dYdt=mass_spring(t, Y)
M=10; %(Kg)
B=.5; %( Nsec/m)
Fa=1; %N
K=1; %(N/m)
dYdt=[0;0];
dYdt(1)=Y(2);
dYdt(2)=-B/M*Y(2)-K/M*Y(1)+Fa/M;

STEP(2)

>> Y0=[0; 0]; %(initial speed and position)


>> [t,Y]=ode45('mass_spring', [0 100],Y0);
plot(t,Y)

IN SIMULINK

SOLUTION
STEP(1)

function dqdt=speed(t, q)
R=1000; %(Kohm)
C=2; %( uF)
Vin=5; %V
dqdt=Vin/R-(1/(C*R))*q;
STEP(2)

>> q0= 0; %(initial speed)


>> [t,q]=ode45('speed', [0 20000],q0);
>> >> plot(t,q);

SIMULINK

SOLUTION:
STEP(1)

function dqdt=mass_spring(t, q)
Vin=10; %(v)
R=15; %( Kohm)
L=1100; %nH
C=3.3; %(pF)
dqdt=[0;0];
dqdt(1)=q(2);
dqdt(2)=
(Vin/L)-(R/L)*q(2)-(1/(L*C)*q(1));
STEP(2)

>> q0=[0; 0];


>> [t,q]=ode45('mass_spring', [0 1000],q0);
>> plot(t,q);

SIMULINK

You might also like