How Is MATLAB Useful for Electrical Engineering? 6 Worked Examples
What electrical engineers really use MATLAB for, shown with six worked problems and their code: AC phasors, power-factor correction, an RLC step response, a Bode plot, harmonics and THD with fft, and a Gauss-Seidel load flow. Plus the toolboxes that matter, free and student access in India, and Skill-Lync placement data.

MATLAB is useful in electrical engineering because most EE work is maths on signals and systems: complex numbers for AC circuits, matrices for power networks, differential equations for transients, Fourier transforms for harmonics and transfer functions for control. MATLAB does all of these in a few lines, and Simulink with Simscape Electrical lets you simulate motors, converters and grids before you build them. Below are six worked EE problems with the MATLAB code and the answers it gives.
In short (as of 20 Nov 2026)
- Current release: MATLAB and Simulink R2026b, announced by MathWorks on 24 Sep 2026. MathWorks says MATLAB has more than 5 million users.
- Free access: any MathWorks account gets MATLAB Online (basic) with 20 hours of use a month, MATLAB, Simulink and nine toolboxes. More than 2,400 schools have a Campus-Wide Licence.
- Student price in India: the MATLAB and Simulink Student Suite is listed at USD 49 on MathWorks' India store, with add-ons such as Motor Control Blockset at USD 13 each (taxes extra).
- Exams: the GATE 2027 EE syllabus (IIT Madras, exams 6-21 Feb 2027) includes Bode plots, root loci, PID control and Gauss-Seidel and Newton-Raphson load flow, all of which MATLAB checks in minutes.
- Jobs: in Skill-Lync's placement records, 106 learners placed in electrical roles had a median starting salary of 3.5 LPA (snapshot 15 Nov 2026, details below).
This guide is for B.Tech/B.E. electrical (EEE) students and freshers who want to know what MATLAB is really used for, and to see it do real EE work. Every number in the examples was reproduced by a script kept with this article. The code uses core MATLAB plus the Control System and Signal Processing Toolboxes; function names are from the R2026b documentation.
What is MATLAB used for in electrical engineering?
Electrical engineers use MATLAB to analyse circuits with complex phasors, design and tune controllers, process and filter signals, study harmonics and power quality, run load-flow and fault studies, model batteries and motors, and generate embedded C code for controllers. Simulink adds block-diagram simulation of whole systems, from an inverter to a grid.
| EE area | Typical task | MATLAB tools |
|---|---|---|
| Circuits and networks | Phasor analysis, mesh and nodal equations, transients | Core MATLAB: complex numbers, A\b, ode45 |
| Control systems | Step response, Bode, root locus, PID tuning | Control System Toolbox: tf, step, bode, rlocus, pidtune |
| Signals and power quality | Filtering, spectra, harmonic distortion | fft; Signal Processing Toolbox: thd, Filter Designer |
| Power systems | Load flow, fault analysis, stability | Core MATLAB matrices; Simscape Electrical for dynamic models |
| Power electronics and drives | Converters, PWM, motor control | Simulink, Simscape Electrical, Motor Control Blockset |
| EV and batteries | Pack models, state of charge, thermal effects | Simscape Battery, Simulink |
| Embedded controllers | Generate production C code from a model | Embedded Coder |
MATLAB also works as a very good calculator for the maths subjects in an EE degree: matrix algebra, Laplace and Fourier transforms (with the Symbolic Math Toolbox) and numerical solutions of differential equations.
Which MATLAB toolboxes do electrical engineers use?
Most electrical work uses core MATLAB, Simulink, the Control System Toolbox and the Signal Processing Toolbox. Power electronics, drives and grid work add Simscape Electrical. EV and motor-control roles add Simscape Battery, Motor Control Blockset and Embedded Coder. Start with the first four; the rest come with the job.
- Simulink: block-diagram simulation of dynamic systems; the base for everything below.
- Simscape Electrical: "model and simulate electronic, mechatronic, and electrical power systems", with semiconductors, motors, grid-scale power and renewable sources. It was formerly SimPowerSystems and SimElectronics, names you still see in older textbooks.
- Control System Toolbox: transfer-function, state-space and zero-pole-gain models; step and Bode plots; controller tuning.
- Signal Processing Toolbox: filtering, spectra and feature extraction, with the Filter Designer and Signal Analyzer apps.
- Motor Control Blockset: motor control algorithms (such as field-oriented control) deployed as C or HDL code to microcontrollers, FPGAs or SoCs.
- Embedded Coder: generates compact C and C++ code for embedded processors used in mass production. This is the core of model-based design (MBD) jobs in automotive.
Example 1: how do you solve an AC circuit in MATLAB?
Write impedances as complex numbers and let MATLAB do the phasor algebra. For a series R-L-C load on a 230 V, 50 Hz supply, ; the current is , the power factor is the cosine of the impedance angle, and complex power is .
R = 10; L = 50e-3; C = 470e-6; V = 230; f = 50;
w = 2*pi*f;
Z = R + 1j*(w*L - 1/(w*C)); % 10 + 8.94j ohm
I = V/Z;
fprintf('|Z| = %.2f ohm at %.1f deg\n', abs(Z), rad2deg(angle(Z)))
fprintf('|I| = %.2f A, pf = %.3f\n', abs(I), cos(angle(Z)))
S = V*conj(I); % complex power in VA
P = real(S), Q = imag(S)
Results: , , so at 41.8°. The current is 17.15 A lagging by 41.8°, the power factor is 0.746 lagging, and the load draws 2,941 W and 2,628 var. A quick check: W, the same as the real part of S.
Example 2: how big a capacitor corrects the power factor?
To raise a load's power factor, the capacitor must supply the difference in reactive power: , and on a single-phase supply . For a 10 kW load at 0.75 lagging on 230 V, 50 Hz, corrected to 0.95, that is 5,532 var and about 333 µF.
P = 10e3; pf1 = 0.75; pf2 = 0.95; V = 230; w = 2*pi*50;
Qc = P*(tan(acos(pf1)) - tan(acos(pf2))); % var
Cap = Qc/(w*V^2); % farad
fprintf('Qc = %.0f var, C = %.0f uF\n', Qc, Cap*1e6)
The load's reactive power falls from 8,819 var to 3,287 var. The supply current drops from 58.0 A to 45.8 A, 21.1% less, for the same 10 kW. That is why industrial consumers fit capacitor banks: lower current means lower cable losses and, where the tariff penalises a low power factor, a lower bill. Change pf2 to 1.0 and see how much more capacitance the last few points of power factor cost.
Example 3: how do you plot an RLC step response in MATLAB?
Build the transfer function with tf and call step; stepinfo returns overshoot, peak time and settling time. For the capacitor voltage of a series RLC circuit, . With the Example 1 values it overshoots by 17.5% and settles in about 40 ms.
R = 10; L = 50e-3; C = 470e-6;
G = tf(1, [L*C R*C 1]); % Vc/Vin
step(G, 0.06), grid on
S = stepinfo(G) % Overshoot, PeakTime, SettlingTime (2% band)
[wn, zeta] = damp(G) % natural frequency and damping ratio
The theory gives the same answer, which is a good habit to check:
The peak comes at ms. The simulation settles inside a 2% band at 39.7 ms, close to the textbook estimate ms.
step(G) shows for the Example 1 circuit. Curve and markers computed by the article's script (Skill-Lync, 20 Nov 2026).Example 4: how do you draw a Bode plot in MATLAB?
Create the transfer function and call bode; set the frequency unit to Hz with bodeoptions. For an RC low-pass filter with R = 1 kΩ and C = 1 µF, : the corner frequency is Hz, where the gain is −3 dB and the phase −45°.
R = 1e3; C = 1e-6;
H = tf(1, [R*C 1]);
fc = 1/(2*pi*R*C) % 159.2 Hz
opts = bodeoptions; opts.FreqUnits = 'Hz';
bode(H, opts), grid on
Above the gain falls at 20 dB per decade: −20.0 dB at 1.59 kHz (10 × ), and −16.1 dB at 1 kHz. The same two lines work for any transfer function, which is why Bode plots, gain margin (margin) and root loci (rlocus) are the usual first MATLAB exercises in a control-systems lab.
bode draws the same curves.Example 5: how do you find harmonics and THD with MATLAB's fft?
Sample the waveform over a whole number of cycles, take fft, scale it to a single-sided amplitude spectrum and read the harmonic peaks. THD is the RMS of the harmonics divided by the fundamental. For a 325 V peak, 50 Hz voltage with a 20% 5th and 14% 7th harmonic, MATLAB recovers 65.0 V and 45.5 V and a THD of 24.4%.
fs = 10e3; t = 0:1/fs:0.2-1/fs; % 10 cycles of 50 Hz
v = 325*sin(2*pi*50*t) + 65*sin(2*pi*250*t) + 45.5*sin(2*pi*350*t);
N = numel(v); Y = fft(v);
P2 = abs(Y/N); P1 = P2(1:N/2+1); P1(2:end-1) = 2*P1(2:end-1);
f = fs*(0:N/2)/N; % 5 Hz bins
h = P1(ismember(f, 50*(2:40))); % harmonics 2 to 40
THD = sqrt(sum(h.^2))/P1(f == 50) % 0.244
Ten cycles at 10 kHz give 2,000 samples and 5 Hz bins, so every harmonic of 50 Hz falls exactly on a bin and nothing leaks. The theory agrees: . The RMS of the waveform is 236.6 V, higher than the 229.8 V of the pure fundamental, which is why harmonics heat cables and transformers.
The Signal Processing Toolbox has a one-line version, thd(v, fs, 7), which returns about −12.2 dBc. Watch the third argument: it counts harmonics including the fundamental, and the default is 6 (the fundamental plus the 2nd to 6th). With the default, this signal's 7th harmonic would be left out and THD would read −14.0 dBc (20%).
fft returns for the distorted voltage. Computed by the article's script.Example 6: how do you run a load flow in MATLAB?
Build the bus admittance matrix and iterate the bus voltage equation. For two buses, slack bus 1 at 1.0 pu and a line of 0.02 + j0.08 pu feeding a 1.0 + j0.5 pu load at bus 2, Gauss-Seidel from a flat start converges in 7 iterations to |V2| = 0.9329 pu at −4.30°.
At each iteration bus 2's voltage is updated from its scheduled power:
z = 0.02 + 0.08j; y = 1/z;
Y = [y -y; -y y]; % bus admittance matrix
V1 = 1; V2 = 1; % flat start
S2 = -(1.0 + 0.5j); % load at bus 2, as an injection
for k = 1:50
V2new = (conj(S2)/conj(V2) - Y(2,1)*V1)/Y(2,2);
if abs(V2new - V2) < 1e-6, V2 = V2new; break, end
V2 = V2new;
end
fprintf('|V2| = %.4f pu, angle %.2f deg, %d iterations\n', ...
abs(V2), rad2deg(angle(V2)), k)
The slack bus supplies 1.0287 pu real and 0.6149 pu reactive power, so the line loses 0.0287 pu (2.9% of the load) and absorbs 0.1149 pu of reactive power. The same loop with an n × n Y matrix is a full Gauss-Seidel load flow. For large systems you would switch to Newton-Raphson, which converges in fewer iterations; both methods are on the GATE EE syllabus.
Is MATLAB still worth learning for electrical engineers in 2026?
Yes, for most core EE roles. MATLAB and Simulink remain the standard for control design, power-electronics and drive simulation, and model-based design in automotive and EV companies, where Simulink models become production code. Python is a strong free alternative for data analysis and scripting, and many engineers use both.
Skill-Lync's own placement data shows where these skills land. Based on 3,711 Skill-Lync placement records up to 7 Nov 2026 (data snapshot of 15 Nov 2026):
| Group (snapshot 15 Nov 2026) | n | Median starting salary | Middle half (P25-P75) |
|---|---|---|---|
| Electrical domain, all roles | 106 | 3.5 LPA | 3.3-4.0 LPA |
| Electrical: Battery / EV Engineer | 50 | 3.5 LPA | 3.3-4.0 LPA |
| Electrical: MBD / Controls Engineer | 15 | 3.5 LPA | 3.5-3.5 LPA |
| MBD / Controls Engineer, all domains | 118 | 3.5 LPA | 3.5-4.3 LPA |
The companies that hired the most of these electrical-domain learners were Tata Elxsi (25), Expleo Engineering (17) and Ola Electric (17). This is a self-selected sample of Skill-Lync learners who reported a placement, mostly starting offers from 2021-23 (102 of the 106 electrical records are from 2022), so treat it as a starting point, not a market survey; we'll update it as new placements come in.
The honest limit: MATLAB alone rarely gets anyone hired. Employers hire for the engineering (control theory, power electronics, machines) shown through MATLAB and Simulink projects. A Bode plot you can explain beats a certificate you can't.
How can an engineering student get MATLAB in India?
Check first whether your college has a Campus-Wide Licence; more than 2,400 schools do, and it is free to you. If not, MATLAB Online (basic) is free with a MathWorks account for 20 hours a month. The Student Suite costs USD 49 on MathWorks' India store, and GNU Octave 11.3 is a free, largely compatible alternative.
- MATLAB Online (basic): MATLAB, Simulink and nine toolboxes in the browser; 15-minute continuous compute and idle limits, 5 GB MATLAB Drive. Enough for all six examples above.
- MATLAB and Simulink Student Suite: USD 49 on the India store (excluding taxes), add-ons USD 13 each. Our guide to whether MATLAB is free for students compares every route and its limits.
- Onramps: MATLAB Onramp and Simulink Onramp are free self-paced courses; MathWorks describes MATLAB Onramp as about two hours.
- GNU Octave 11.3.0 (1 Jun 2026): free and largely compatible. Examples 1, 2, 5 and 6 use only core functions; Examples 3 and 4 need Octave's control package (
pkg load control), and MATLAB-only options such asbodeoptionsneed small edits.
How should an EEE student learn MATLAB, step by step?
- Week 1: MATLAB Onramp; vectors, matrices, plotting, scripts and functions.
- Week 2: redo your circuits course in MATLAB: phasors (Example 1), mesh equations with
A\b, power-factor problems (Example 2). - Week 3: signals:
fft, filters, harmonics (Example 5). - Week 4: control:
tf,step,bode,rlocus,pidtuneon your lab's plants (Examples 3 and 4). - Weeks 5-6: Simulink and Simscape Electrical: a buck converter, a DC motor speed loop, then a load flow (Example 6) for a 3- or 5-bus textbook system.
- Then: one project you can show, in the area you want to work in (EV, drives, grid or MBD).
Where do Skill-Lync courses fit?
Skill-Lync's MATLAB and Simulink Basics course (12 weeks) covers the core of this guide with projects, and System Modelling and Simulation using Simulink and Simscape (6 weeks) goes into physical models of electrical and mechanical systems. For grid work, see Introduction to Electric Power System. You can compare every Skill-Lync MATLAB course or talk to a Skill-Lync counsellor about which fits your branch and goal. For the theory behind Examples 1 and 2, read our network analysis guide.
Frequently asked questions
Is MATLAB necessary for electrical engineering?
It isn't strictly necessary, but it is the most widely used tool for EE simulation, especially control, power electronics and model-based design. If you are heading for control, power-electronics, EV or automotive MBD roles, expect Simulink on the job and in interviews. Python can replace parts of it for data work, but not Simulink-based roles.
Is MATLAB or Python better for electrical engineers?
Learn MATLAB and Simulink if you aim for control, drives, power electronics or automotive MBD jobs; their toolboxes and code generation are the industry standard there. Learn Python if you lean towards data analysis, automation or machine learning on grid or sensor data. Many engineers use both: Simulink for the system, Python for the data around it.
Which MATLAB toolbox is used for power systems?
Simscape Electrical, formerly SimPowerSystems, is MathWorks' toolbox for electrical power systems in Simulink, covering machines, converters, grid components and renewable sources. For steady-state studies such as load flow and short-circuit calculations, many students write their own MATLAB code with the bus admittance matrix, as in Example 6, which is also how GATE expects you to think.
Can I use MATLAB for free?
Yes, within limits. Any MathWorks account includes MATLAB Online (basic) for 20 hours a month with MATLAB, Simulink and nine toolboxes. Many colleges also have a Campus-Wide Licence, free to their students. Beyond that, the Student Suite costs USD 49 on MathWorks' India store, and GNU Octave is a free alternative.
Does MATLAB help in GATE EE preparation?
It helps you understand, not answer: GATE is a timed exam without MATLAB. But plotting Bode diagrams, root loci and step responses, or iterating a load flow, makes the GATE 2027 control and power-systems topics concrete. Use it to check your hand solutions, then practise solving by hand.
Sources and further reading
- MathWorks introduces Release 2026b of MATLAB and Simulink, MathWorks, 24 Sep 2026 (accessed 20 Nov 2026).
- About MathWorks (5 million+ users) and MATLAB Campus-Wide Licence (2,400+ schools), MathWorks (accessed 20 Nov 2026).
- MATLAB Online versions, MathWorks (accessed 20 Nov 2026).
- MathWorks Store, India: student products and MATLAB and Simulink Student Suite, MathWorks (accessed 20 Nov 2026).
- Simscape Electrical, Simscape Battery, Control System Toolbox, Signal Processing Toolbox, Motor Control Blockset and Embedded Coder product pages, MathWorks (accessed 20 Nov 2026).
- Function reference: tf, step, bode, fft and thd, MathWorks documentation (accessed 20 Nov 2026).
- Online courses FAQ (Onramps free) and MATLAB Onramp overview (about two hours), MathWorks (accessed 20 Nov 2026).
- GNU Octave news (11.3.0 released 1 Jun 2026), GNU Octave (accessed 20 Nov 2026).
- GATE 2027 and the GATE 2027 EE syllabus, IIT Madras (accessed 20 Nov 2026).
- Skill-Lync placement records, snapshot of 15 Nov 2026 (3,711 records up to 7 Nov 2026; electrical domain n = 106).
- Worked examples: calc.py and the figure scripts kept in the article's run folder (Skill-Lync blog engine, 20 Nov 2026).


