Email: helpdesk@telkomuniversity.ac.id

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/How to Calculate dominant frequency and centroid frequency and plot them together

How to Calculate dominant frequency and centroid frequency and plot them together

PuTI / 2025-01-17
How to Calculate dominant frequency and centroid frequency and plot them together
Matlab News

please help me, I would like to calculate dominant and centroid frequency and plot them tohether in one plot. Please CMIIW if i have misundertanding the basic concept. As I undertand, dominant freq is higest freq that appear in our signal. I used FFT and get the max power. And about dominant freq I am not quite sure. What makes me don’t understand is, if I take example from weighted mean as basic of centroid freq, based on example in https://en.wikipedia.org/wiki/Weighted_arithmetic_mean, after calculate weighted mean we have weighted mean of the frequencies present in the signal, meaning that is not a single value. I use spectralCentroid to calculate centroid frequency, but then i confuse, if i have single falue for dominant freq and several value from spectralCentroid, how i should plot them together?
i also attach my file, basically the code will doing looping as my file represent one day data, so my goal is plot dominant and centroid freq in one plot for 1 month. I assume my dominant freq has 30 data point, but not sure about spectralCentroid.
this is my attempt to do it.
sig=load(‘signal2023-335.txt’);

%BAND PASS FILTER long range –> can be considered as UNFILTER condition
% Define the parameters
lowcut = 1/400; % Low cutoff frequency in Hz
high1 = 40; % High cutoff frequency in Hz
high2 = 1.25; % Midrange cutoff frequency in Hz
fs = 100; % Sampling frequency in Hz

% Design the Butterworth bandpass filter (UNFILTER)
[bU, aU] = butter(2,[lowcut high1] / (fs / 2), ‘bandpass’);
sigUnfilt= filtfilt(bU,aU,sig);

% calculate FFT UNFILT
n=length(sigUnfilt);
srate=100; %sampling rate
nyq=srate/2;
fftsig=fft(sigUnfilt-mean(sigUnfilt))/n; %dataX is fft result from filtered signal
hz=linspace(0,nyq,floor(n/2)+1);
pow=2*abs(fftsig(1:length(hz)));
Iv = 1:numel(hz);

%get the maximum freq/dominant freq
[~,idx] = max(pow) ;
domfreq = hz(idx)

% Calculate centroid frequency
centroid = spectralCentroid(sigUnfilt,100)please help me, I would like to calculate dominant and centroid frequency and plot them tohether in one plot. Please CMIIW if i have misundertanding the basic concept. As I undertand, dominant freq is higest freq that appear in our signal. I used FFT and get the max power. And about dominant freq I am not quite sure. What makes me don’t understand is, if I take example from weighted mean as basic of centroid freq, based on example in https://en.wikipedia.org/wiki/Weighted_arithmetic_mean, after calculate weighted mean we have weighted mean of the frequencies present in the signal, meaning that is not a single value. I use spectralCentroid to calculate centroid frequency, but then i confuse, if i have single falue for dominant freq and several value from spectralCentroid, how i should plot them together?
i also attach my file, basically the code will doing looping as my file represent one day data, so my goal is plot dominant and centroid freq in one plot for 1 month. I assume my dominant freq has 30 data point, but not sure about spectralCentroid.
this is my attempt to do it.
sig=load(‘signal2023-335.txt’);

%BAND PASS FILTER long range –> can be considered as UNFILTER condition
% Define the parameters
lowcut = 1/400; % Low cutoff frequency in Hz
high1 = 40; % High cutoff frequency in Hz
high2 = 1.25; % Midrange cutoff frequency in Hz
fs = 100; % Sampling frequency in Hz

% Design the Butterworth bandpass filter (UNFILTER)
[bU, aU] = butter(2,[lowcut high1] / (fs / 2), ‘bandpass’);
sigUnfilt= filtfilt(bU,aU,sig);

% calculate FFT UNFILT
n=length(sigUnfilt);
srate=100; %sampling rate
nyq=srate/2;
fftsig=fft(sigUnfilt-mean(sigUnfilt))/n; %dataX is fft result from filtered signal
hz=linspace(0,nyq,floor(n/2)+1);
pow=2*abs(fftsig(1:length(hz)));
Iv = 1:numel(hz);

%get the maximum freq/dominant freq
[~,idx] = max(pow) ;
domfreq = hz(idx)

% Calculate centroid frequency
centroid = spectralCentroid(sigUnfilt,100) please help me, I would like to calculate dominant and centroid frequency and plot them tohether in one plot. Please CMIIW if i have misundertanding the basic concept. As I undertand, dominant freq is higest freq that appear in our signal. I used FFT and get the max power. And about dominant freq I am not quite sure. What makes me don’t understand is, if I take example from weighted mean as basic of centroid freq, based on example in https://en.wikipedia.org/wiki/Weighted_arithmetic_mean, after calculate weighted mean we have weighted mean of the frequencies present in the signal, meaning that is not a single value. I use spectralCentroid to calculate centroid frequency, but then i confuse, if i have single falue for dominant freq and several value from spectralCentroid, how i should plot them together?
i also attach my file, basically the code will doing looping as my file represent one day data, so my goal is plot dominant and centroid freq in one plot for 1 month. I assume my dominant freq has 30 data point, but not sure about spectralCentroid.
this is my attempt to do it.
sig=load(‘signal2023-335.txt’);

%BAND PASS FILTER long range –> can be considered as UNFILTER condition
% Define the parameters
lowcut = 1/400; % Low cutoff frequency in Hz
high1 = 40; % High cutoff frequency in Hz
high2 = 1.25; % Midrange cutoff frequency in Hz
fs = 100; % Sampling frequency in Hz

% Design the Butterworth bandpass filter (UNFILTER)
[bU, aU] = butter(2,[lowcut high1] / (fs / 2), ‘bandpass’);
sigUnfilt= filtfilt(bU,aU,sig);

% calculate FFT UNFILT
n=length(sigUnfilt);
srate=100; %sampling rate
nyq=srate/2;
fftsig=fft(sigUnfilt-mean(sigUnfilt))/n; %dataX is fft result from filtered signal
hz=linspace(0,nyq,floor(n/2)+1);
pow=2*abs(fftsig(1:length(hz)));
Iv = 1:numel(hz);

%get the maximum freq/dominant freq
[~,idx] = max(pow) ;
domfreq = hz(idx)

% Calculate centroid frequency
centroid = spectralCentroid(sigUnfilt,100) centroid frequency, fft, centroid, weighted mean MATLAB Answers — New Questions

​

Tags: matlab

Share this!

Related posts

Import PyTorch LSTM Model into Matlab
2025-05-14

Import PyTorch LSTM Model into Matlab

appdesigner – disruptive help popups
2025-05-14

appdesigner – disruptive help popups

What are the signs that my parameter estimator is on the right track before convergence?
2025-05-14

What are the signs that my parameter estimator is on the right track before convergence?

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: helpdesk@telkomuniversity.ac.id
  • 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