Ead Final 3676
Ead Final 3676
2. sin^2(theta)+cos^2(theta)=1 in 29/01/25
Simulink.
Aim
To develop mathematical and Simulink models for a Mass-Spring-Damper system and
observe the step response
In this model, the masses represent the inertial properties of the object, with their mass values
determining how they respond to applied forces. The springs mimic the elastic properties of the
material, providing resistance to deformation and restoring forces when displaced from
equilibrium. The dampers, on the other hand, introduce a damping effect that dissipates energy
and reduces oscillations within the system.
Deriving the equations of motion for this model is usually done by examining the sum of
forces on the mass:
Precautions-
• Ensure that the circuit is properly modelled and simulated according to the specifications
and operating conditions.
• Choose appropriate component values for the circuit to avoid damage or overloading to the
circuit or the simulation program.
• Double-check the connections and node names in the schematic to avoid errors or
incomplete circuits.
• Use appropriate signal sources and apply safe voltage and current levels to the circuit to
avoid damaging the components or simulation program.
Simulation Circuit
Output Graph
AIM : To simulate and verify the identity sin²(θ) + cos²(θ) = 1 in MATLAB Simulink using basic
Blocks.
In this experiment:
SIMULINK CIRCUIT :
OUTPUT :
Precautions:
● Ensure both Sine Wave blocks have the same frequency and amplitude.
● Set the Phase of one Sine Wave block to π/2 to simulate cos(θ).
● Keep a small simulation step size (e.g., 0.01) for smooth curves and accurate results
Experiment-3
Aim
To Simulate the waveform of full wave controlled and uncontrolled rectifier using MATLAB.
Among full-wave rectifiers, the most prevalent type is the bridge rectifier. This configuration
employs four diodes arranged in a bridge pattern. During the positive half cycle of the AC
voltage, two diodes conduct, enabling current to flow through the load in one direction.
Similarly, during the negative half cycle, the other two diodes conduct, facilitating current
flow in the opposite direction. This alternating conduction of diodes ensures that the load
receives a continuous supply of current, resulting in a more efficient rectification process
compared to half-wave rectifiers.
The output of a full wave rectifier exhibits a pulsating DC waveform, containing both positive
and negative voltage peaks. However, to obtain a smoother DC output suitable for most
applications, additional filtering is required. This is typically achieved using a filter circuit
comprising capacitors or inductors. These components help reduce the ripple voltage present
in the output, ensuring a more stable and constant DC voltage supply.
In summary, full wave rectifiers, particularly bridge rectifiers, play a pivotal role in converting
AC voltage to DC voltage efficiently. By utilizing both halves of the AC waveform, they offer
higher efficiency and smoother output compared to half-wave rectifiers. With their versatility
and widespread application, full-wave rectifiers serve as indispensable components in modern
electronic systems, ensuring reliable and stable DC power supplies for various devices and
equipment.
Precautions-
• Ensure that the circuit is properly modelled and simulated according to the specifications
and operating conditions.
• Choose appropriate component values for the circuit to avoid damage or overloading to the
circuit or the simulation program.
• Double-check the connections and node names in the schematic to avoid errors or
incomplete circuits.
• Use appropriate signal sources and apply safe voltage and current levels to the circuit to
avoid damaging the components or simulation program.
Simulation Circuit
(a)Controlled Rectifier
Output Graph
AIM:
To analyze and compare the transient responses of an RLC circuit under different damping
conditions—underdamped, critically damped, and overdamped—using Simulink by varying the resistor
(R) value while keeping the inductor (L) and capacitor (C) constant.
APPARATUS REQUIRED:
Hardware: Function Generator, Oscilloscope, Resistors (1 Ω, 2 Ω, 5 Ω), Inductor (1 H), Capacitor (1 F),
Breadboard, Wires.
DIAGRAM:
THEORY:
An RLC circuit consists of a resistor (R), inductor (L), and capacitor (C) connected in series or parallel.
The transient response of the circuit is influenced by the damping ratio (ζ\zetaζ), which determines the
nature of the response when the circuit is subjected to a step input.
Damping Conditions:
1. Underdamped (ζ<1\zeta < 1ζ<1):
CIRCUIT:
RESULT:
PRECAUTIONS:
AIM:
To simulate inverting and non-inverting operational amplifier circuits in LTspice,
and to analyze their behavior using MATLAB for waveform visualization and analysis.
SOFTWARE REQUIRED:
THEORY:
SIMULATION DIAGRAM
1. Inverting Amplifier
OUTPUT
RESULT : The MATLAB plot shows the input and output waveforms of the op-amp
circuits:
● In the inverting configuration, the output is 180° out of phase with the input and
scaled by the gain factor.
● In the non-inverting configuration, the output is in phase with the input and
amplified based on the resistor ratio.
PRECAUTIONS:
1. Ensure correct resistor values (Rin and Rf) are used to achieve the desired gain.
2. In LTSpice, connect power supplies (V+ and V−) to the Op-Amp for proper
operation.
3. Export the simulation data in a readable format (CSV or TXT) for MATLAB.
4. In MATLAB, make sure to match the file name and data format while loading.
5. Verify the node voltages in LTSpice to ensure proper data export (e.g., add
.plot directives or use the waveform viewer correctly).
EXPERIMENT-6
AIM:
To design and simulate circuits in LTSpice to generate square and triangular waveforms, analyze their
behavior, and understand their applications in electronic systems.
APPARATUS REQUIRED:
· Ground Connection
THEORY:
● A square wave is a periodic waveform that alternates between two levels, typically high and low
(e.g., +5V and 0V).
● It can be generated using a pulse voltage source with a PULSE function in LTSpice or an
astable 555 timer circuit.
● The waveform is characterized by a 50% duty cycle, where the high and low states last for equal
durations.
● A triangular wave is a continuous, piecewise-linear waveform that rises and falls linearly over
time.
● It can be generated using an integrator circuit built with an op-amp, resistor, and capacitor.
● The square wave input is integrated (i.e., the area under the curve is calculated), producing a
triangular waveform.
● The slope of the triangular wave depends on the input signal frequency and the RC time constant.
CIRCUIT:
RESULT:
The simulation successfully generated square and triangular waves in LTSpice, matching theoretical
expectations with correct frequency, amplitude, and waveform shape.
PRECAUTION:
Aim:To write a MATLAB program to solve a quadratic equation of the form ax^2 + bx +
c = 0 and find its roots (real or complex) using the quadratic formula.
Software Required:
Theory:
D=b2−4ac
● If D>0D > 0D>0: The equation has two real and distinct roots.
● If D=0D = 0D=0: The equation has two real and equal roots.
● If D<0D < 0D<0: The equation has two complex conjugate roots.
MATLAB can handle both real and complex numbers, which makes it a convenient tool for
solving such equations.
CODE-
RESULT -
Conclusion:
The experiment successfully demonstrates how to solve a quadratic equation using MATLAB.
Based on the coefficients provided, the program calculates the discriminant, determines the
nature of the roots, and accurately displays them.
Experiment-8
Aim To develop a MATLAB program that takes a user-defined date as input and
displays the corresponding day of the week
Software Used:
MATLAB (version R2024b)
Theory
This experiment uses MATLAB to determine the day of the week for a user-provided
date. The program accepts a date in the "dd-MMM-yyyy" format (e.g., "08-Apr-
2025"), processes it using MATLAB's date-handling capabilities, and displays the
corresponding weekday name.
1.User Input: 2. The user is prompted to enter a date as a string. The format must
follow the
pattern dd-MMM-yyyy where:
dd = Day (e.g., 08) MMM = 3-letter month
abbreviation (e.g., Apr) yyyy = Year (e.g.,
2025)
3.Conversion to Datetime Object: 4. The datetime() function is used to convert the
string into a date object. The
'InputFormat' ensures MATLAB correctly interprets the input format.
5.Finding the Day:
6. The weekday() function extracts both the day number (1 = Sunday, 2 = Monday,
etc.) and the corresponding day name (e.g., "Tuesday").
7.Error Handling: 8. A try-catch block is used to handle invalid input formats. If the
user enters a date
incorrectly, the program shows a helpful message without crashing.
This method provides a simple and reliable way to determine the day for any given
date using MATLAB's built-in date processing functions.
Code
Output
Precautions-
Ensure the date is entered in the correct format: dd-MMM-yyyy (e.g., 08-Apr-
2025).
Use valid three-letter month abbreviations (e.g., Jan, Feb, Mar, etc.).
Do not enter an invalid date (e.g., 31-Feb-2024), as it will trigger an error.
Be mindful of the case sensitivity in month abbreviations—MATLAB is case-
insensitive by default, but using proper capitalization improves readability.
Make sure to enclose the date input in double quotes if entering it directly in the
code (e.g., "08-Apr-2025").
Experiment-9
Aim
To solve the differential
equation
with the initial condition y(0)=1, and compute the value of y(1.0) using Euler’s
Method with a step size h=0.2
Software/Hardware Used
MATLAB (version R2024b)
Theory Euler’s method is one of the most fundamental and straightforward numerical
methods for solving first-order ordinary differential equations (ODEs). It is particularly
useful when an analytical solution is difficult or impossible to obtain.
In this experiment, we are solving the initial value problem:
This equation represents a first-order ODE where the derivative of y depends on both x
and y values. Euler’s method is derived from the Taylor series expansion, truncated
after the first derivative. It approximates the value of y at a future point using the
slope (i.e., derivative) at the current point.
At each step, we compute the value of y using the Euler formula and update x by adding h.
Euler’s method provides a first-order approximation, which means the accuracy improves with
smaller step sizes. Although not as accurate as higher-order methods (like Runge-Kutta), it is
easy to implement and understand, making it ideal for foundational understanding and quick
calculations.
Code
Output
Precautions
In this experiment:
● f(x, y) = -y
MATLAB CODE -
RESULT -
PRECAUTIONS - 1. Ensure the step size h is small enough for a good approximation.
2. Double-check initial conditions before running the code.
3. Preallocate arrays in MATLAB for better performance.
4. Verify that f(x, y) is correctly implemented in the loop.
5. Ensure number of steps n matches (xf - x0)/h.
EXPERIMENT 11
k₁ = h * f(x₀, y₀)
k₂ = h * f(x₀ + h/2, y₀ + k₁/2)
k₃ = h * f(x₀ + h/2, y₀ + k₂/2)
k₄ = h * f(x₀ + h, y₀ + k₃)
Then,
y(x₀ + h) = y₀ + (1/6) * (k₁ + 2k₂ + 2k₃ + k₄)
This method calculates the slope at multiple points and averages them for higher
accuracy.
MATLAB CODE :
RESULT :
PRECAUTIONS :
3. Use a sufficient number of iterations to get the solution for the desired xxx-value.
4. Be careful when implementing the Runge-Kutta method to avoid any errors in the
formula calculations.
5. Always verify the solution by comparing it with an analytical solution, if possible,
or checking the results for consistency.
EXPERIMENT 12
AIM : Using Runge - Kutta Method solve dy/dx = y-x/y+x where y(0) = 1 and find the
values of y(0.2) taking h = 0.1
k1 = h * f(x_n, y_n)
k2 = h * f(x_n + h/2, y_n + k1/2)
k3 = h * f(x_n + h/2, y_n + k2/2)
k4 = h * f(x_n + h, y_n + k3)
y_{n+1} = y_n + (1/6) * (k1 + 2k2 + 2k3 + k4)
Here :
dy/dx = (y - x)/(y + x)
y(0) = 1
h = 0.1
Find y(0.2)
MATLAB CODE:
RESULT :
PRECAUTIONS :
● Ensure that the differential equation is well-defined and continuous in the given
interval.