Programming for Electrical Engineers,
Edition 1 MATLAB and Spice
By James C. Squire, Ph.D., Electrical Engineering, MIT, Cambridge, MA and Julie Phillips Brown, Ph.D., English Language and Literature, Cornell University, Ithaca, NY, USA

Publication Date: 10 Sep 2020

Programming for Electrical Engineers: MATLAB and Spice introduces beginning engineering students to programming in Matlab and Spice through engaged, problem-based learning and dedicated electrical and computer engineering content. The book draws its problems and examples specifically from electrical and computer engineering, covering such topics as circuit analysis, signal processing, and filter design. It teaches relevant computational techniques in the context of solving common problems in electrical and computer engineering, including mesh and nodal analysis, Fourier transforms, and phasor analysis.

Programming for Electrical Engineers: MATLAB and Spice is unique among MATLAB textbooks for its dual focus on introductory-level learning and discipline-specific content in electrical and computer engineering. No other textbook on the market currently targets this audience with the same attention to discipline-specific content and engaged learning practices. Although it is primarily an introduction to programming in MATLAB, the book also has a chapter on circuit simulation using Spice, and it includes materials required by ABET Accreditation reviews, such as information on ethics, professional development, and lifelong learning.

Key Features

  • Discipline-specific: Introduces Electrical and Computer Engineering-specific topics, such as phasor analysis and complex exponentials, that are not covered in generic engineering Matlab texts
  • Accessible: Pedagogically appropriate for freshmen and sophomores with little or no prior programming experience
  • Scaffolded content: Addresses both script and functions but emphasizes the use of functions since scripts with non-scoped variables are less-commonly encountered after introductory courses
  • Problem-centric: Introduces MATLAB commands as needed to solve progressively more complex EE/ECE-specific problems, and includes over 100 embedded, in-chapter questions to check comprehension in stages and support active learning exercises in the classroom
  • Enrichment callouts: "Pro Tip" callouts cover common ABET topics, such as ethics and professional development, and "Digging Deeper" callouts provide optional, more detailed material for interested students
About the author
By James C. Squire, Ph.D., Electrical Engineering, MIT, Cambridge, MA, Department of Electrical Engineering, Virginia Military Institute, Lexington, VA, USA and Julie Phillips Brown, Ph.D., English Language and Literature, Cornell University, Ithaca, NY, USA, Department of English, Rhetoric, & Humanistic Studies, Virginia Military Institute, Lexington, VA, USA
Table of Contents


Purpose of this text

Software for Electrical Engineers

Formatting conventions

Chapter 1: Introduction to MATLAB


Starting MATLAB and the workspace

Using MATLAB as a calculator


Tech Tip: Charge and current

Naming and inspecting variables

Parentheses and implied multiplication

Special symbols: i, j, and p

Tech Tip: Voltage, current, charge, & resistance

Formatting numbers

Scientific notation

Exponentials and their inverses

Trig functions and their inverses

Pro Tip: IEEE

Creating vectors

Use of the semicolon

Tech Tip: Ohm’s Law

Plotting data

Getting help

Tech Tip: Using a digital multimeter (DMM) to measure steady voltage

Saving and loading variables

Keyboard shortcuts

Pro Tip: Careers in Electrical Engineering

Chapter 1 command review

Lab problems

Chapter 2: MATLAB as a Calculator



Tech Tip: Measuring resistance


Creating vectors

Tech Tip: Resistors in series and parallel

Working with vectors

Complex numbers

Vector mathematics

Pro Tip: Buying a digital multimeter (DMM)


Creating matrices

Tech Tip: Mesh and nodal analysis methods

Changing matrix values

Working with matrices

Tech Tip: Voltage dividers

Solving simultaneous equations

Command review

Pro Tip: Buying a calculator

Lab problems

Chapter 3: Plotting with MATLAB


Types of plots

Tech Tip: Oscilloscopes

Line plot

Line plots with multiple lines

Scatter plots

Tech Tip: Bode plots

Plot scripts

Layering plot commands with hold()

Pro Tip: Professional licensure (PE)

Bar plots


Tech Tip: Low pass filters

Advanced plot decoration

Text annotation

Tech Tip: Greek symbols in ECE

Advanced text formatting

Three dimensional MATLAB plots

Pro Tip: IEEE code of ethics

Command review

Lab problems

Chapter 4: MATLAB Programming


Why program?


Tech Tip: Wire sizing


Function arguments

Creating your own functions

Commenting programs

More complex function examples


Pro Tip: Graduate studies in EE

Relational expressions

Logical operators

Logical operations on vectors and matrices

Tech Tip: Engineering notation

Conditional statements: if-end

Conditional statements: if-else-end

Tech Tip: Resistor color codes

Conditional statements: elseif

Creating strings with embedded numbers

Pro Tip: Industry or graduate school?

Command review

Lab problems

Chapter 5: Programming II: Looping



for-end loops

Tech Tip: Monte Carlo simulations

Indexing vectors inside for loops

Nested loops

Using nested loops for exact solutions

Using nested loops for best solutions

Pro Tip: Non-engineering careers

tic, toc

Functions calling functions


Tech Tip: Binary math in MATLAB

Multiple functions in one m-file

while-end loops

Growing vectors vs. preallocation

Pro Tip: Fundamentals of engineering (FE)

Command review

Lab problems

Chapter 6: Spice


Circuit simulation

Tech Tip: What is ground?


Installing LTspice

Tech Tip: Power vs. energy (work)

Steps in simulating

Schematic editor

Pro Tip: Ethics II

Types of LTspice simulations

DC simulation walkthrough

Tech Tip: 555 timer

Transient simulation

AC sweep simulation

Tech Tip: Operational amplifiers

Advanced tip: using nets

Pro Tip: Lifelong learning

Command review

Lab problems


Book details
ISBN: 9780128215029
Page Count: 288
Retail Price : £50.99

9780128154793; 9780124202283; 9780128122037

Instructor Resources

First and second year engineering students in Electrical and Computer Engineering (EE/CpE/ECE) programs / professionals across all technical areas interested in teaching themselves MATLAB programming