Skip to content
You Start with one site
Amounts in Start with one site
Engineering · Mathematics, AI & Reasoning

Modeling and Simulation

Make your mistakes on a model, before they cost a board, a motor or a trip to the site. Nine Python projects, each with an answer you use: a battery runtime, a heatsink verdict, PID gains for your firmware, a filter for your sensor.

Found this useful?
Monte Carlo against the worst case for a 3.3 V divider with 5 percent resistors. The specification band runs from 3.2 to 3.4 V. The worst case runs from 3.220 to 3.443 V, past the upper limit. The histogram of the simulated boards, centred near 3.33 V, has 92.2 percent inside the band and 7.8 percent above 3.4 V.

A battery-powered sensor stops a day earlier than the calculation promised, because capacity over average current cannot see bursts of current and a falling voltage. A voltage regulator that works on the bench fails in a closed box in the sun. A speed controller is tuned by trial on the machine, and one wrong setting breaks a belt. The average divider gives 3.3 V, and some boards are still scrapped.

In this course you write the physics as equations, give them to a solver in Python, and check the result against a formula you can work by hand. Each lesson builds one tool: a runtime predictor, a circuit analyzer, a suspension tuner, a heatsink sizer, a PID tuner, a Kalman filter, a filter designer, a tolerance analyzer and a model fitter for measured data.

How each simulation goes
  1. 1Write the physicsA cell as equations: the charge falls with the current, and 0.05 Ω inside pulls the voltage 0.025 V down in a burst.
  2. 2Give it to a solverBursts of 500 mA for 2 s in every 10. The time step decides how much of each burst the simulation sees.
  3. 3Check it by handRC is 10 ms: the simulated curve passes 63.2 percent at 10 ms and 99.3 percent at 50 ms, as the formula says.
  4. 4Test it on new dataThree models fitted to a noisy step. The best leaves 0.079, the size of the noise, and 0.080 on a ramp it has not seen.
You will be able to
  1. Write a system as equations, solve it in Python, and check it against a hand calculation
  2. Predict a runtime, a temperature or a response, and size a part or tune a controller from it
  3. Count how often a design fails, and fit a model to measured data

New to this? New to simulation? Start with lesson 1: predict how long a battery-powered sensor really runs.

You need A computer with Python, NumPy, SciPy and Matplotlib. Each lesson is one file.

The engineering behind it

Model a circuit, a machine or a control loop in Python, and test it before you build it.

Lessons
Lesson 1 · 7 minFrom Equations to SimulationsPredict how long a lithium cell runs under bursts of 500 mA, with a solver in Python.State equationssolve_ivpLoad profileCutoff voltage Lesson 2 · 7 minSimulating Electrical CircuitsDraw the step response and the Bode plot of RC and RLC circuits before you solder a part.Step responseBode plotDamping ratioHand checks Lesson 3 · 6 minMechanical System DynamicsA suspension tuner that finds the damping which brings a quarter car to rest soonest.Mass, spring, damperDamping ratioSettling timePhase portrait Lesson 4 · 7 minThermal Modeling for ElectronicsA heatsink sizer: the path of heat from chip to air, and a clear verdict, safe or danger.Thermal resistanceThermal capacitanceWarm-upHeatsink choice Lesson 5 · 8 minControl System Design in SimulationA DC motor with a PID controller, tuned in simulation, with gains to take to firmware.Motor modelPIDOvershootDisturbances Lesson 6 · 10 minSensor Fusion and State EstimationOne angle from a noisy accelerometer and a drifting gyroscope, with complementary and Kalman filters.Complementary filterKalman filterNoise valuesIMU Lesson 7 · 8 minSimulating Signal Processing PipelinesA filter designer that shows what a filter removes and what it delays, then gives the numbers for C.Moving averageButterworthAliasingDecimation Lesson 8 · 7 minMonte Carlo Methods10,000 random boards: how often a divider is outside its limits, and how far.Tolerance stackupYieldDistributionsWorst case Lesson 9 · 9 minSystem Identification from DataFit a model to a measured step response, and test it on new data before you trust it.Least squaresFirst and second orderResidualsValidation
More about this course

Every number has a reason

A simulation earns its place when it shows a number the plain calculation hides.

  • 4.2 percentof the charge still in the cell when a burst, 0.025 V below the resting voltage, first reaches the 3.0 V cutoffBatteries
  • 86 °Cthe regulator in a box in the sun: 40 °C air plus a 46 °C rise, over the 85 °C limit; on the bench at 25 °C it is 71 °CHeat
  • 690 RPMwhere the motor levels under P control alone, 310 below the 1000 RPM target; the integral term removes the gapControl
  • 92.2 percentof 10,000 simulated dividers with 5 percent resistors inside 3.2 to 3.4 V; the other 7.8 percent are aboveTolerance
  • 0.079the fit error of a second-order model with delay, the size of the 0.08 noise; a first-order model leaves 0.343Identification

The worst case says a board can fail. Monte Carlo says how many will.

Worst case
Every part at its limit
  • 5 percent resistors give 3.220 to 3.443 V
  • Past the 3.4 V limit, so a failure is possible
  • Asked for where a failure can harm people

The test: can any board fail at all?

Monte Carlo
10,000 random boards
  • 92.2 percent inside, 7.8 percent above 3.4 V
  • All parts are almost never at their limits together
  • The answer depends on the spread you assume: bell-shaped gives 99.5 percent

The test: how many fail, and is the assumed spread true?

The tools

One Python file a lessonNumPy, SciPy and Matplotlib, and nothing else.
Equations to a solversolve_ivp turns the physics into a time line.
Checked by handEach simulation against a formula you can work on paper.
An answer you useA runtime, a verdict, gains or filter numbers for C.
No hardware neededNo paid software and no cloud account.
Back to the real partThe last lesson fits a model to measured data.

Honest limits. A model is only as good as its numbers. Gains from a simulation go to the firmware as a starting point, and a measurement on the real part, a temperature, a ringdown or a step response, decides whether the model was right.

Before you start

The full course notes

Build it in simulation before you build it in hardware. Every lesson in this course contains a complete, runnable Python project that produces something you can actually use: a battery runtime prediction, a circuit frequency response, a heatsink temperature verdict, a set of PID gains ready to paste into firmware, or a Kalman filter for sensor fusion. The only tools you need are Python, NumPy, SciPy, and Matplotlib.

This course puts mathematics to work, turning equations into simulations of real engineering systems. If you want a deeper look at the underlying math, the Applied Mathematics course covers calculus, linear algebra, differential equations, and control theory.

What You Need

Terminal window
pip install numpy scipy matplotlib

Every lesson runs in a single .py file. No special hardware, no paid software, no cloud accounts.

Lessons

Lesson 1: From Equations to Simulations

Set up the Python simulation workflow with SciPy’s solve_ivp. Model a lithium cell voltage curve and simulate discharge under a real IoT load profile. Predict battery runtime.

Start Lesson 1

Lesson 2: Simulating Electrical Circuits

Build RC and RLC circuit models. Generate step responses, verify time constants, sweep frequency for Bode plots, and compare simulation to oscilloscope measurements.

Start Lesson 2

Lesson 3: Mechanical System Dynamics

Model a spring-mass-damper and sweep the damping ratio. Build a suspension tuner that finds the optimal damping for minimum settling time with bounded overshoot.

Start Lesson 3

Lesson 4: Thermal Modeling for Electronics

Build thermal resistance networks for electronic components. The heatsink sizer tells you if your chip stays within safe operating temperature, or if you need a bigger heatsink.

Start Lesson 4

Lesson 5: Control System Design in Simulation

Model a DC motor with inertia, friction, and back-EMF. Design a PID controller, tune gains in simulation, analyze overshoot and settling time. Paste the gains into your firmware.

Start Lesson 5

Lesson 6: Sensor Fusion and State Estimation

Fuse noisy accelerometer and drifting gyroscope data with complementary and Kalman filters. The algorithm that runs on every drone, robot, and phone.

Start Lesson 6

Lesson 7: Simulating Signal Processing Pipelines

Design digital filters in Python, apply them to noisy sensor data, and export the coefficients for implementation in C on your MCU.

Start Lesson 7

Lesson 8: Monte Carlo Methods for Engineering Decisions

When every component has a tolerance, will your circuit still work? Run 10,000 random trials and find out. Tolerance stackup analysis for circuits and mechanical assemblies.

Start Lesson 8

Lesson 9: System Identification from Measured Data

Given real sensor data, fit a mathematical model. The reverse of simulation: start with measurements, end with equations you can use in a controller.

Start Lesson 9



How Each Lesson Works

  1. Physics first

    Every lesson starts with the governing equations. You understand what you are simulating and why, before writing any code.

  2. Build the model

    Translate the equations into Python functions that SciPy can solve.

  3. Run the simulation

    Execute the script. Get plots, numbers, and engineering insight. Each project produces output you can use in a real design.

  4. Experiment

    Change parameters, observe the effect, build intuition. Simulation is cheap. Use it.

Who This Course Is For

Embedded Engineers

Verify thermal margins, tune PID loops, and estimate battery life before your PCB arrives.

Engineering Students

Connect differential equations to real engineering problems with code that produces real answers.

Hobbyists and Makers

Understand why your motor oscillates, why your circuit rings, or why your battery dies early.

© 2021-2026 SiliconWit®. All rights reserved.

9 lessons, in order.

SiliconWit makes these courses. We also run siliconwit.io, a monitoring service.