Email: [email protected]

This Portal for internal use only!

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • IBM
  • Visual Paradigm
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Office
      • Windows
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Categories
  • Microsoft
    • Microsoft Apps
    • Office
    • Operating System
    • VLS
    • Developer Tools
    • Productivity Tools
    • Database
    • AI + Machine Learning
    • Middleware System
    • Learning Services
    • Analytics
    • Networking
    • Compute
    • Security
    • Internet Of Things
  • Adobe
  • Matlab
  • Google
  • Visual Paradigm
  • WordPress
    • Plugin WP
    • Themes WP
  • Opensource
  • Others
More Categories Less Categories
  • Get Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • My Account
    • Download
    • Cart
    • Checkout
    • Login
  • About Us
    • Contact
    • Forum
    • Frequently Questions
    • Privacy Policy
  • Forum
    • News
      • Category
      • News Tag

iconTicket Service Desk

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • IBM
  • Visual Paradigm
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Office
      • Windows
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Menu
  • Home
    • Download Application Package Repository Telkom University
    • Application Package Repository Telkom University
    • Download Official License Telkom University
    • Download Installer Application Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • All Pack
    • Microsoft
      • Operating System
      • Productivity Tools
      • Developer Tools
      • Database
      • AI + Machine Learning
      • Middleware System
      • Networking
      • Compute
      • Security
      • Analytics
      • Internet Of Things
      • Learning Services
    • Microsoft Apps
      • VLS
    • Adobe
    • Matlab
    • WordPress
      • Themes WP
      • Plugin WP
    • Google
    • Opensource
    • Others
  • My account
    • Download
    • Get Pack
    • Cart
    • Checkout
  • News
    • Category
    • News Tag
  • Forum
  • About Us
    • Privacy Policy
    • Frequently Questions
    • Contact
Home/Matlab/FRF – PSD Calculation Using Welch’s Method Producing Less Sharp Peaks for a Linear System

FRF – PSD Calculation Using Welch’s Method Producing Less Sharp Peaks for a Linear System

PuTI / 2025-01-24
FRF – PSD Calculation Using Welch’s Method Producing Less Sharp Peaks for a Linear System
Matlab News

Hi,
I am attempting to compute the Frequency Response Function (FRF) of a linear system using Welch’s method for estimating the Power Spectral Density (PSD). However, the results I obtain lack the sharp peaks expected for a linear system, and I would like guidance on whether my code or approach is correct, or if I might be missing something fundamental.
Despite using these settings and varying the parameters, the FRF I compute does not show sharp peaks that I expect for a linear system. The peaks are relatively broad, which makes it difficult to identify resonant frequencies clearly. I am uncertain whether:
My choice of parameters (e.g., nfft,window_length,noverlapnfft, window_length, noverlapnfft,window_length,noverlap) is contributing to this issue.
There might be a problem in my preprocessing or interpretation of the data.
Please advise, thankyou!
Fs = 8192;
window_length = 3144;
noverlap = 0.75*window_length;
nfft = 2048;

FileName = ‘exp1_0’;
FileStart = 1;
FileEnd = 10;
fileDirectory = ‘D:xx’;

% Define the window function
window_function = hanning(window_length);

% Initialize accumulators for averaging
sum_Pxx = 0; % Sum of auto-power spectrum of voltage
sum_Pxy = 0; % Sum of cross-power spectrum

% Loop over all test files = averaging
for filenum = FileStart:FileEnd

% Load data from each file
fullFileName = [fileDirectory, FileName, sprintf(‘%02d’, filenum), ‘.mat’];
fileData = load(fullFileName);

% Extract Velocity and Voltage Data
velocity_data = fileData.([FileName, sprintf(‘%02d’, filenum)]).Y(4).Data; % Output: Velocity (m/s)
voltage_data = fileData.([FileName, sprintf(‘%02d’, filenum)]).Y(3).Data; % Input: Voltage (V)

% Compute PSDs using Welch’s method
[Pxx, f] = pwelch(voltage_data, window_function, noverlap, nfft, Fs); % Auto-power spectrum of voltage
[Pxy, ~] = cpsd(velocity_data, voltage_data, window_function, noverlap, nfft, Fs); % Cross-power spectrum

% Accumulate results for averaging
sum_Pxx = sum_Pxx + Pxx;
sum_Pxy = sum_Pxy + Pxy;
end

% Compute FRF (H = Pxy / Pxx)
H = sum_Pxy ./ sum_Pxx;

% Convert to dB
H_mag_dB = 20 * log10(abs(H));

% Apply smoothing and moving average
window_size = 5;
smoothed_H_w = smoothdata(H_mag_dB, ‘movmean’, window_size);

% Plot FRF
figure;
plot(f, smoothed_H_w , ‘r’);
hold on;
title([‘FRF of Random Test with – Window Length: ‘, num2str(window_length), …
‘, Overlap: ‘, num2str(noverlap), …
‘, nfft: ‘, num2str(nfft)]);
xlabel(‘Frequency (Hz)’);
ylabel(‘Magnitude (dB)’);
grid on;
xlim([1 300]);
hold off;Hi,
I am attempting to compute the Frequency Response Function (FRF) of a linear system using Welch’s method for estimating the Power Spectral Density (PSD). However, the results I obtain lack the sharp peaks expected for a linear system, and I would like guidance on whether my code or approach is correct, or if I might be missing something fundamental.
Despite using these settings and varying the parameters, the FRF I compute does not show sharp peaks that I expect for a linear system. The peaks are relatively broad, which makes it difficult to identify resonant frequencies clearly. I am uncertain whether:
My choice of parameters (e.g., nfft,window_length,noverlapnfft, window_length, noverlapnfft,window_length,noverlap) is contributing to this issue.
There might be a problem in my preprocessing or interpretation of the data.
Please advise, thankyou!
Fs = 8192;
window_length = 3144;
noverlap = 0.75*window_length;
nfft = 2048;

FileName = ‘exp1_0’;
FileStart = 1;
FileEnd = 10;
fileDirectory = ‘D:xx’;

% Define the window function
window_function = hanning(window_length);

% Initialize accumulators for averaging
sum_Pxx = 0; % Sum of auto-power spectrum of voltage
sum_Pxy = 0; % Sum of cross-power spectrum

% Loop over all test files = averaging
for filenum = FileStart:FileEnd

% Load data from each file
fullFileName = [fileDirectory, FileName, sprintf(‘%02d’, filenum), ‘.mat’];
fileData = load(fullFileName);

% Extract Velocity and Voltage Data
velocity_data = fileData.([FileName, sprintf(‘%02d’, filenum)]).Y(4).Data; % Output: Velocity (m/s)
voltage_data = fileData.([FileName, sprintf(‘%02d’, filenum)]).Y(3).Data; % Input: Voltage (V)

% Compute PSDs using Welch’s method
[Pxx, f] = pwelch(voltage_data, window_function, noverlap, nfft, Fs); % Auto-power spectrum of voltage
[Pxy, ~] = cpsd(velocity_data, voltage_data, window_function, noverlap, nfft, Fs); % Cross-power spectrum

% Accumulate results for averaging
sum_Pxx = sum_Pxx + Pxx;
sum_Pxy = sum_Pxy + Pxy;
end

% Compute FRF (H = Pxy / Pxx)
H = sum_Pxy ./ sum_Pxx;

% Convert to dB
H_mag_dB = 20 * log10(abs(H));

% Apply smoothing and moving average
window_size = 5;
smoothed_H_w = smoothdata(H_mag_dB, ‘movmean’, window_size);

% Plot FRF
figure;
plot(f, smoothed_H_w , ‘r’);
hold on;
title([‘FRF of Random Test with – Window Length: ‘, num2str(window_length), …
‘, Overlap: ‘, num2str(noverlap), …
‘, nfft: ‘, num2str(nfft)]);
xlabel(‘Frequency (Hz)’);
ylabel(‘Magnitude (dB)’);
grid on;
xlim([1 300]);
hold off; Hi,
I am attempting to compute the Frequency Response Function (FRF) of a linear system using Welch’s method for estimating the Power Spectral Density (PSD). However, the results I obtain lack the sharp peaks expected for a linear system, and I would like guidance on whether my code or approach is correct, or if I might be missing something fundamental.
Despite using these settings and varying the parameters, the FRF I compute does not show sharp peaks that I expect for a linear system. The peaks are relatively broad, which makes it difficult to identify resonant frequencies clearly. I am uncertain whether:
My choice of parameters (e.g., nfft,window_length,noverlapnfft, window_length, noverlapnfft,window_length,noverlap) is contributing to this issue.
There might be a problem in my preprocessing or interpretation of the data.
Please advise, thankyou!
Fs = 8192;
window_length = 3144;
noverlap = 0.75*window_length;
nfft = 2048;

FileName = ‘exp1_0’;
FileStart = 1;
FileEnd = 10;
fileDirectory = ‘D:xx’;

% Define the window function
window_function = hanning(window_length);

% Initialize accumulators for averaging
sum_Pxx = 0; % Sum of auto-power spectrum of voltage
sum_Pxy = 0; % Sum of cross-power spectrum

% Loop over all test files = averaging
for filenum = FileStart:FileEnd

% Load data from each file
fullFileName = [fileDirectory, FileName, sprintf(‘%02d’, filenum), ‘.mat’];
fileData = load(fullFileName);

% Extract Velocity and Voltage Data
velocity_data = fileData.([FileName, sprintf(‘%02d’, filenum)]).Y(4).Data; % Output: Velocity (m/s)
voltage_data = fileData.([FileName, sprintf(‘%02d’, filenum)]).Y(3).Data; % Input: Voltage (V)

% Compute PSDs using Welch’s method
[Pxx, f] = pwelch(voltage_data, window_function, noverlap, nfft, Fs); % Auto-power spectrum of voltage
[Pxy, ~] = cpsd(velocity_data, voltage_data, window_function, noverlap, nfft, Fs); % Cross-power spectrum

% Accumulate results for averaging
sum_Pxx = sum_Pxx + Pxx;
sum_Pxy = sum_Pxy + Pxy;
end

% Compute FRF (H = Pxy / Pxx)
H = sum_Pxy ./ sum_Pxx;

% Convert to dB
H_mag_dB = 20 * log10(abs(H));

% Apply smoothing and moving average
window_size = 5;
smoothed_H_w = smoothdata(H_mag_dB, ‘movmean’, window_size);

% Plot FRF
figure;
plot(f, smoothed_H_w , ‘r’);
hold on;
title([‘FRF of Random Test with – Window Length: ‘, num2str(window_length), …
‘, Overlap: ‘, num2str(noverlap), …
‘, nfft: ‘, num2str(nfft)]);
xlabel(‘Frequency (Hz)’);
ylabel(‘Magnitude (dB)’);
grid on;
xlim([1 300]);
hold off; fft, psd MATLAB Answers — New Questions

​

Tags: matlab

Share this!

Related posts

Generate ST code from a look-up table with CONSTANT attribute
2025-05-22

Generate ST code from a look-up table with CONSTANT attribute

“no healthy upstream” error when trying to access My Account
2025-05-22

“no healthy upstream” error when trying to access My Account

MATLAB Answers is provisionally back?
2025-05-21

MATLAB Answers is provisionally back?

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Categories

  • Matlab
  • Microsoft
  • News
  • Other
Application Package Repository Telkom University

Tags

matlab microsoft opensources
Application Package Download License

Application Package Download License

Adobe
Google for Education
IBM
Matlab
Microsoft
Wordpress
Visual Paradigm
Opensource

Sign Up For Newsletters

Be the First to Know. Sign up for newsletter today

Application Package Repository Telkom University

Portal Application Package Repository Telkom University, for internal use only, empower civitas academica in study and research.

Information

  • Telkom University
  • About Us
  • Contact
  • Forum Discussion
  • FAQ
  • Helpdesk Ticket

Contact Us

  • Ask: Any question please read FAQ
  • Mail: [email protected]
  • Call: +62 823-1994-9941
  • WA: +62 823-1994-9943
  • Site: Gedung Panambulai. Jl. Telekomunikasi

Copyright © Telkom University. All Rights Reserved. ch

  • FAQ
  • Privacy Policy
  • Term

This Application Package for internal Telkom University only (students and employee). Chiers... Dismiss