Frequency Response Analysis in MATLAB

MATLAB Illustration

Frequency Response Plots in MATLAB

Frequency response analysis shows how a system (LTI system, filter, amplifier, etc.) responds to different input frequencies. Key plots: Bode plot (magnitude & phase vs. frequency), Nyquist plot (complex plane), Nichols plot.

Key Functions

  • bode(): Bode plot (mag/phase in dB/degrees vs. log frequency).
  • nyquist(): Polar plot of G(jω) in complex plane.
  • nichols(): Nichols chart (mag in dB vs. phase).
  • freqz(): For digital filters (discrete-time).
  • margin(): Stability margins (gain/phase margins).

Basic Steps

  1. Define System: Transfer function sys = tf([1 2], [1 3 2]) or state-space.
  2. Plot: bode(sys); grid on;.
  3. Customize: Set frequency range, labels, limits.
  4. Analyze: Read bandwidth, resonance peaks, phase margins.

Example Code

% Define a second-order system (low-pass filter)  num = [1]; den = [1 2 50]; % ω_n = 7.07 rad/s, ζ = 0.141  sys = tf(num, den);    % Bode plot  figure; bode(sys); grid on;  title('Frequency Response: Bode Plot');  xlabel('Frequency (rad/s)');    % Or manual control  [mag, phase, w] = bode(sys);  figure;   subplot(2,1,1); semilogx(w, 20*log10(squeeze(mag))); grid on;   ylabel('Magnitude (dB)'); title('Bode Plot');  subplot(2,1,2); semilogx(w, squeeze(phase)); grid on;   ylabel('Phase (deg)'); xlabel('Frequency (rad/s)');

For Digital Filters

% FIR/IIR filter  b = fir1(30, 0.3); a = 1; % 30-tap FIR low-pass  [h, f] = freqz(b, a, 512, 1000); % fs = 1kHz  figure; plot(f, 20*log10(abs(h))); grid on;  title('Digital Filter Frequency Response');  xlabel('Frequency (Hz)'); ylabel('Magnitude (dB)');
 
 

Applications

  • Control systems: Stability, bandwidth analysis.
  • Filters: Cutoff frequency, roll-off verification.
  • Amplifiers: Gain flatness, phase shift.
  • Power electronics: Converter transfer functions.

Pro Tips: Use bodemag(), bodephase() for separate plots. Add rlocus() for root locus comparison. Always check units (rad/s vs Hz).

What Our Students Say

★★★★★

“I got full marks on my MATLAB assignment! The solution was perfect and delivered well before the deadline. Highly recommended!”

Aditi Sharma, Mumbai
★★★★☆

“Quick delivery and excellent communication. The team really understood the problem and provided a great solution. Will use again.”

John M., Australia

Latest Blogs

Explore how MATLAB Solutions has helped clients achieve their academic and research goals through practical, tailored assistance.

MCP-Enabled Robotics Control Systems with MATLAB

In today\\\'s rapidly advancing era of automation, robotics control systems are evolving to meet the demand for smarter, faster, and more reliable performance. Among the many innovations driving this transformation is the use of MCP (Model-based Control Paradigms)

LLM-Driven Financial Forecasting Models in MATLAB

The financial sector is witnessing a technological revolution with the rise of Large Language Models (LLMs). Traditionally used for text analysis, LLMs are now being integrated with powerful platforms like MATLAB to develop financial forecasting models