Skip to content

Repository files navigation

matlab

A collection of MATLAB scripts covering numerical methods, vector/statics calculations, physics simulations, and CMOS device analysis — written while studying engineering, physics, and electrical engineering.

Requirements

MATLAB (no toolboxes required beyond base MATLAB, except centroidCalculation.m and numericalIntegration3D.m, which use the Symbolic Math Toolbox for syms/int).

Usage

Open any script in MATLAB and run it. Scripts noted as "Interactive" below prompt for input in the command window; the rest run on hard-coded example data — edit the constants/vectors near the top of the file to use your own values.

Contents

numerical-methods/

Root-finding, interpolation, integration, and iterative numeric techniques.

File Description
NewtonRaphson.m Finds roots of a user-supplied function via Newton-Raphson iteration and compares the result against MATLAB's fzero (reports approximate and true error). Interactive.
BaselProblem.m Numerically verifies Euler's solution to the Basel problem (sum(1/n^2) = pi^2/6) by summing terms until the partial sum matches to a user-specified number of decimal places. Interactive.
bungeeJumper_part1.m / part2.m Computes and plots a bungee jumper's velocity over time from mass and drag coefficient, using a numeric ODE step method. Part 2 adds the velocity-vs-time plot.
idealGas_interpolation.m Uses cubic spline interpolation to estimate the volume of an ideal gas in a piston cylinder from a table of pressure/volume points.
predictVoltage_interpolation.m Fits a first-order polynomial (line) through voltage-vs-time data points to predict circuit voltage.
compareIntegrals.m Computes a definite integral numerically with trapz and compares against the analytic/integral result.
numericalIntegration2D.m Demonstrates 2D numerical integration with trapz on discrete data and a sampled function.
numericalIntegration3D.m Demonstrates volume/multivariable integration using symbolic (syms) and inline functions. Requires Symbolic Math Toolbox.
centroidCalculation.m Calculates the centroid (x̂, ŷ) of the area between two curves using symbolic integration. Requires Symbolic Math Toolbox.

vector-statics/

Vector algebra and statics fundamentals.

File Description
crossProduct.m Demonstrates properties of the vector cross product (anti-commutativity, distributivity, non-associativity) with worked numeric examples.
dotProduct.m Demonstrates properties of the vector dot product (commutativity, non-associativity) with worked numeric examples.
tripleProduct.m Computes the scalar triple product a · (b × c) for three example vectors.
calculatingMoments.m Statics example: computes the moment of a force about the origin and about two specified lines, given force and position vectors.
simultaneousEquations.m Solves a 2x2 system of linear equations by setting up Ax = b and solving with the backslash operator.

simulations/

Time-stepped physics and population simulations.

File Description
calc_simplePendulum.m Simulates and plots the motion of a simple pendulum from initial angular displacement, length, and simulation time; computes the oscillation period. Interactive.
bouncingBall.m Simulates a ball dropped from a height, bouncing on a surface multiple times, tracking position and velocity in a while loop.
populationGrowth.m Models world population growth 1950–2023 against a real Kaggle dataset.
growthModel_exponentialLogistic.m Runs exponential or logistic population growth models (switchable) using a for loop.
growthModel_variant2.m Interactive forward-Euler population growth simulation (initial size, growth rate, time step, number of steps all user-supplied).
newtonsSecondLaw_verification.m Loads force/acceleration data from CSV (per-cart trials) and verifies Newton's Second Law (F = ma) by fitting mass from the data.

cmos-nanoelectronics/

CMOS technology scaling and SOI MOSFET analysis (EGEC 556, Spring 2026 — the most recent work in this repo).

File Description
theoretical_scaling.m Calculates and plots theoretical CMOS scaling predictions across generations, comparing Constant Field (Dennard), Constant Voltage, and real-world scaling.
analyze_scaling_trends.m Analyzes and plots scaling trends (e.g. threshold voltage, leakage) across the 180nm/90nm/45nm technology nodes.
short_channel_effects.m Models and visualizes short-channel effects (e.g. DIBL, threshold roll-off) in scaled CMOS devices.
import_ltspice_data.m Imports LTSpice-exported waveform data (tab-separated text) and generates comparison plots. Includes instructions for exporting from LTSpice.
soi_iv_characteristics.m Compares I-V characteristics of SOI vs. bulk MOSFETs.
soi_performance_comparison.m Compares performance metrics (e.g. speed, power) of SOI vs. bulk MOSFETs.

utilities/

Small, general-purpose reference functions.

File Description
findEvens.m Returns only the even numbers from an input array.
findOdd10.m Returns only the odd numbers greater than 10 from an input array.
findOdds.m Returns only the odd numbers from an input array.
findThrees.m Returns only the multiples of three from an input array.
findPositiveRoots.m Returns the square roots of the positive values in an input array.
findPositiveRootsEvenOrOdd.m Like findPositiveRoots.m, but with an optional second argument ('e'/'o') to restrict to even- or odd-indexed positive values.
findInputType.m Determines whether an input argument is a scalar, vector, or matrix.
findY.m Evaluates a user-defined piecewise function y = f(x).
pickOne.m Returns a random element from a 1-D array.
fibonacci.m Generates and prints Fibonacci sequence values.
customSort.m Custom sort implementation: sorts a 2D array so the lowest value lands at (1,1) and remaining values proceed row-major in ascending order.
matrixTraceDiag.m Returns the diagonal of a square matrix and the sum of its diagonal elements; errors on non-square input.
calculateBMI.m Calculates BMI from mass (kg) and height (cm).
tempConvert.m Converts a Fahrenheit input to Celsius and Kelvin. Interactive.
cylinderVolume.m Calculates the volume of a cylinder from user-supplied radius and height. Interactive.
massHollowSphere.m Calculates the mass of a hollow sphere from inner/outer diameter and density. Interactive.
lensCalc.m Menu-driven calculator for ideal lens/mirror parameters (focal length, object/image distance, magnification). Interactive.
parkingBill.m Calculates a parking bill total from hours parked, via a tiered rate function. Interactive.
rocketStage.m Determines a rocket's flight stage (e.g. "Free Flight", "Stage 3") from elapsed time in seconds.

misc-projects/

File Description
olympicMedalSort.m Menu-driven program that reads Olympic athlete data (2000–2012) from a text file and supports lookups/sorting by athlete, country, and medal counts. Requires OlympicAtheletes.txt (not included) in the working directory.

License

See LICENSE.

About

a collection of useful matlab scripts for engineers, physicists and curious students

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages