Email: helpdesk@telkomuniversity.ac.id

This Portal for internal use only!

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

All Categories

  • Visual Paradigm
  • IBM
  • 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
      • Windows
      • Office
  • 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

  • Visual Paradigm
  • IBM
  • 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
      • Windows
      • Office
  • 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/Problem with identifying the entropy stabilization point in SSA for accurate signal decomposition.

Problem with identifying the entropy stabilization point in SSA for accurate signal decomposition.

PuTI / 2025-01-14
Problem with identifying the entropy stabilization point in SSA for accurate signal decomposition.
Matlab News

In Singular Spectrum Analysis (SSA), the goal is to decompose a signal into three main components:
Trend: The overall trend of the signal, which represents long-term changes.
Oscillations: Parts of the signal that change periodically, typically corresponding to medium-term variations.
Noise: Parts of the signal that change randomly, usually representing noise or disturbances in the signal.
In this process, the signal is first transformed into a trajectory matrix, and then its components are extracted via Singular Value Decomposition (SVD).
Main Challenge:
After performing SVD and calculating the entropy of each component, we are looking for a point where the entropy stabilizes. This point is considered where additional components no longer contribute meaningful information to the model.
The problem is that the point of entropy stabilization is not being correctly identified, which results in an improper decomposition of the signal into the three components (trend, oscillations, and noise).
Question: Is there a method in MATLAB that can more accurately identify the point of entropy stabilization and correctly decompose the signal into trend, oscillations, and noise?

clc;
clear;
close all;

% Load the CSV file
[file, path] = uigetfile(‘*.csv’, ‘Please upload your CSV file:’);
if isequal(file, 0)
error(‘No file selected.’);
end
data = readtable(fullfile(path, file));

% Display available columns for the user to choose from
disp(‘Available columns in your dataset:’);
disp(data.Properties.VariableNames’);
column_name = input(‘Enter the column name you want to analyze: ‘, ‘s’);

% Extract the signal (time series) from the chosen column
if ~any(strcmp(data.Properties.VariableNames, column_name))
error([‘Column "’, column_name, ‘" not found in the dataset.’]);
end
signal = data.(column_name);
signal = signal(~isnan(signal)); % Drop NaN values

% SSA Functions
function X = trajectory_matrix(signal, window_length)
N = length(signal);
K = N – window_length + 1;
X = zeros(window_length, K);
for i = 1:K
X(:, i) = signal(i:i + window_length – 1);
end
end

function entropy = singular_entropy(S)
P = S / sum(S);
entropy = -sum(P .* log(P));
end

function reconstructed_signal = reconstruct_signal(U, S, V, indices, original_length)
reconstructed_trajectory = zeros(size(U, 1), size(V, 1));
for i = indices
reconstructed_trajectory = reconstructed_trajectory + S(i) * (U(:, i) * V(i, :));
end

[rows, cols] = size(reconstructed_trajectory);
signal_length = rows + cols – 1;
reconstructed_signal = zeros(signal_length, 1);
counts = zeros(signal_length, 1);

% Extracting anti-diagonals
for k = 1:(rows + cols – 1)
anti_diag_elements = [];
for i = 1:rows
j = k – i + 1;
if j >= 1 && j <= cols
anti_diag_elements = [anti_diag_elements; reconstructed_trajectory(i, j)];
end
end
reconstructed_signal(k) = mean(anti_diag_elements);
counts(k) = length(anti_diag_elements);
end

reconstructed_signal = reconstructed_signal ./ counts; % Normalize the signal
reconstructed_signal = reconstructed_signal(1:original_length);
end

% Perform SSA
window_length = floor(length(signal) / 3); % Adjust window length
X = trajectory_matrix(signal, window_length);

% Perform SVD decomposition
[U, S_mat, V] = svd(X, ‘econ’);
S = diag(S_mat);

% Calculate Singular Entropy for each component cumulatively
cumulative_entropy = zeros(length(S), 1);
for i = 1:length(S)
cumulative_entropy(i) = singular_entropy(S(1:i));
end

% Plot Singular Entropy to observe stabilization point
figure;
plot(1:length(S), cumulative_entropy, ‘-o’, ‘LineWidth’, 1.5);
xlabel(‘Component Index’);
ylabel(‘Cumulative Singular Entropy’);
title(‘Cumulative Singular Entropy vs. Component Index’);
grid on;

% Calculate the point where entropy stabilizes
entropy_diff = diff(cumulative_entropy); % Difference between consecutive entropy values
threshold = 0.01; % Threshold to detect stabilization
stable_point = find(entropy_diff < threshold, 1);

% Mark the stabilization point
hold on;
xline(stable_point + 1, ‘–r’, [‘Stabilization Point: ‘, num2str(stable_point + 1)]);
legend(‘Cumulative Singular Entropy’, ‘Stabilization Point’);

% Number of components based on entropy stabilization
num_components = stable_point + 1;
disp([‘Number of components based on entropy stabilization: ‘, num2str(num_components)]);

% Reconstruct the signal by categorizing components
trend_indices = 1; % Trend corresponds to the first component
oscillation_indices = 2:num_components; % Oscillations from second component to stabilization point
noise_indices = (num_components + 1):length(S); % Noise corresponds to components after stabilization

% Reconstruct signals based on selected indices
trend_signal = reconstruct_signal(U, S, V’, trend_indices, length(signal));
oscillation_signal = reconstruct_signal(U, S, V’, oscillation_indices, length(signal));
noise_signal = reconstruct_signal(U, S, V’, noise_indices, length(signal));

% Plot the original signal, Trend, Oscillations, and Noise
figure;
plot(signal, ‘b’, ‘DisplayName’, ‘Original Signal’, ‘LineWidth’, 1.5);
hold on;
plot(trend_signal, ‘g’, ‘DisplayName’, ‘Trend’, ‘LineWidth’, 1.5);
plot(oscillation_signal, ‘orange’, ‘DisplayName’, ‘Oscillations’, ‘LineWidth’, 1.5);
plot(noise_signal, ‘r’, ‘DisplayName’, ‘Noise’, ‘LineWidth’, 1.5);
title(‘Signal Decomposition’);
xlabel(‘Time’);
ylabel(‘Amplitude’);
legend;
grid on;In Singular Spectrum Analysis (SSA), the goal is to decompose a signal into three main components:
Trend: The overall trend of the signal, which represents long-term changes.
Oscillations: Parts of the signal that change periodically, typically corresponding to medium-term variations.
Noise: Parts of the signal that change randomly, usually representing noise or disturbances in the signal.
In this process, the signal is first transformed into a trajectory matrix, and then its components are extracted via Singular Value Decomposition (SVD).
Main Challenge:
After performing SVD and calculating the entropy of each component, we are looking for a point where the entropy stabilizes. This point is considered where additional components no longer contribute meaningful information to the model.
The problem is that the point of entropy stabilization is not being correctly identified, which results in an improper decomposition of the signal into the three components (trend, oscillations, and noise).
Question: Is there a method in MATLAB that can more accurately identify the point of entropy stabilization and correctly decompose the signal into trend, oscillations, and noise?

clc;
clear;
close all;

% Load the CSV file
[file, path] = uigetfile(‘*.csv’, ‘Please upload your CSV file:’);
if isequal(file, 0)
error(‘No file selected.’);
end
data = readtable(fullfile(path, file));

% Display available columns for the user to choose from
disp(‘Available columns in your dataset:’);
disp(data.Properties.VariableNames’);
column_name = input(‘Enter the column name you want to analyze: ‘, ‘s’);

% Extract the signal (time series) from the chosen column
if ~any(strcmp(data.Properties.VariableNames, column_name))
error([‘Column "’, column_name, ‘" not found in the dataset.’]);
end
signal = data.(column_name);
signal = signal(~isnan(signal)); % Drop NaN values

% SSA Functions
function X = trajectory_matrix(signal, window_length)
N = length(signal);
K = N – window_length + 1;
X = zeros(window_length, K);
for i = 1:K
X(:, i) = signal(i:i + window_length – 1);
end
end

function entropy = singular_entropy(S)
P = S / sum(S);
entropy = -sum(P .* log(P));
end

function reconstructed_signal = reconstruct_signal(U, S, V, indices, original_length)
reconstructed_trajectory = zeros(size(U, 1), size(V, 1));
for i = indices
reconstructed_trajectory = reconstructed_trajectory + S(i) * (U(:, i) * V(i, :));
end

[rows, cols] = size(reconstructed_trajectory);
signal_length = rows + cols – 1;
reconstructed_signal = zeros(signal_length, 1);
counts = zeros(signal_length, 1);

% Extracting anti-diagonals
for k = 1:(rows + cols – 1)
anti_diag_elements = [];
for i = 1:rows
j = k – i + 1;
if j >= 1 && j <= cols
anti_diag_elements = [anti_diag_elements; reconstructed_trajectory(i, j)];
end
end
reconstructed_signal(k) = mean(anti_diag_elements);
counts(k) = length(anti_diag_elements);
end

reconstructed_signal = reconstructed_signal ./ counts; % Normalize the signal
reconstructed_signal = reconstructed_signal(1:original_length);
end

% Perform SSA
window_length = floor(length(signal) / 3); % Adjust window length
X = trajectory_matrix(signal, window_length);

% Perform SVD decomposition
[U, S_mat, V] = svd(X, ‘econ’);
S = diag(S_mat);

% Calculate Singular Entropy for each component cumulatively
cumulative_entropy = zeros(length(S), 1);
for i = 1:length(S)
cumulative_entropy(i) = singular_entropy(S(1:i));
end

% Plot Singular Entropy to observe stabilization point
figure;
plot(1:length(S), cumulative_entropy, ‘-o’, ‘LineWidth’, 1.5);
xlabel(‘Component Index’);
ylabel(‘Cumulative Singular Entropy’);
title(‘Cumulative Singular Entropy vs. Component Index’);
grid on;

% Calculate the point where entropy stabilizes
entropy_diff = diff(cumulative_entropy); % Difference between consecutive entropy values
threshold = 0.01; % Threshold to detect stabilization
stable_point = find(entropy_diff < threshold, 1);

% Mark the stabilization point
hold on;
xline(stable_point + 1, ‘–r’, [‘Stabilization Point: ‘, num2str(stable_point + 1)]);
legend(‘Cumulative Singular Entropy’, ‘Stabilization Point’);

% Number of components based on entropy stabilization
num_components = stable_point + 1;
disp([‘Number of components based on entropy stabilization: ‘, num2str(num_components)]);

% Reconstruct the signal by categorizing components
trend_indices = 1; % Trend corresponds to the first component
oscillation_indices = 2:num_components; % Oscillations from second component to stabilization point
noise_indices = (num_components + 1):length(S); % Noise corresponds to components after stabilization

% Reconstruct signals based on selected indices
trend_signal = reconstruct_signal(U, S, V’, trend_indices, length(signal));
oscillation_signal = reconstruct_signal(U, S, V’, oscillation_indices, length(signal));
noise_signal = reconstruct_signal(U, S, V’, noise_indices, length(signal));

% Plot the original signal, Trend, Oscillations, and Noise
figure;
plot(signal, ‘b’, ‘DisplayName’, ‘Original Signal’, ‘LineWidth’, 1.5);
hold on;
plot(trend_signal, ‘g’, ‘DisplayName’, ‘Trend’, ‘LineWidth’, 1.5);
plot(oscillation_signal, ‘orange’, ‘DisplayName’, ‘Oscillations’, ‘LineWidth’, 1.5);
plot(noise_signal, ‘r’, ‘DisplayName’, ‘Noise’, ‘LineWidth’, 1.5);
title(‘Signal Decomposition’);
xlabel(‘Time’);
ylabel(‘Amplitude’);
legend;
grid on; In Singular Spectrum Analysis (SSA), the goal is to decompose a signal into three main components:
Trend: The overall trend of the signal, which represents long-term changes.
Oscillations: Parts of the signal that change periodically, typically corresponding to medium-term variations.
Noise: Parts of the signal that change randomly, usually representing noise or disturbances in the signal.
In this process, the signal is first transformed into a trajectory matrix, and then its components are extracted via Singular Value Decomposition (SVD).
Main Challenge:
After performing SVD and calculating the entropy of each component, we are looking for a point where the entropy stabilizes. This point is considered where additional components no longer contribute meaningful information to the model.
The problem is that the point of entropy stabilization is not being correctly identified, which results in an improper decomposition of the signal into the three components (trend, oscillations, and noise).
Question: Is there a method in MATLAB that can more accurately identify the point of entropy stabilization and correctly decompose the signal into trend, oscillations, and noise?

clc;
clear;
close all;

% Load the CSV file
[file, path] = uigetfile(‘*.csv’, ‘Please upload your CSV file:’);
if isequal(file, 0)
error(‘No file selected.’);
end
data = readtable(fullfile(path, file));

% Display available columns for the user to choose from
disp(‘Available columns in your dataset:’);
disp(data.Properties.VariableNames’);
column_name = input(‘Enter the column name you want to analyze: ‘, ‘s’);

% Extract the signal (time series) from the chosen column
if ~any(strcmp(data.Properties.VariableNames, column_name))
error([‘Column "’, column_name, ‘" not found in the dataset.’]);
end
signal = data.(column_name);
signal = signal(~isnan(signal)); % Drop NaN values

% SSA Functions
function X = trajectory_matrix(signal, window_length)
N = length(signal);
K = N – window_length + 1;
X = zeros(window_length, K);
for i = 1:K
X(:, i) = signal(i:i + window_length – 1);
end
end

function entropy = singular_entropy(S)
P = S / sum(S);
entropy = -sum(P .* log(P));
end

function reconstructed_signal = reconstruct_signal(U, S, V, indices, original_length)
reconstructed_trajectory = zeros(size(U, 1), size(V, 1));
for i = indices
reconstructed_trajectory = reconstructed_trajectory + S(i) * (U(:, i) * V(i, :));
end

[rows, cols] = size(reconstructed_trajectory);
signal_length = rows + cols – 1;
reconstructed_signal = zeros(signal_length, 1);
counts = zeros(signal_length, 1);

% Extracting anti-diagonals
for k = 1:(rows + cols – 1)
anti_diag_elements = [];
for i = 1:rows
j = k – i + 1;
if j >= 1 && j <= cols
anti_diag_elements = [anti_diag_elements; reconstructed_trajectory(i, j)];
end
end
reconstructed_signal(k) = mean(anti_diag_elements);
counts(k) = length(anti_diag_elements);
end

reconstructed_signal = reconstructed_signal ./ counts; % Normalize the signal
reconstructed_signal = reconstructed_signal(1:original_length);
end

% Perform SSA
window_length = floor(length(signal) / 3); % Adjust window length
X = trajectory_matrix(signal, window_length);

% Perform SVD decomposition
[U, S_mat, V] = svd(X, ‘econ’);
S = diag(S_mat);

% Calculate Singular Entropy for each component cumulatively
cumulative_entropy = zeros(length(S), 1);
for i = 1:length(S)
cumulative_entropy(i) = singular_entropy(S(1:i));
end

% Plot Singular Entropy to observe stabilization point
figure;
plot(1:length(S), cumulative_entropy, ‘-o’, ‘LineWidth’, 1.5);
xlabel(‘Component Index’);
ylabel(‘Cumulative Singular Entropy’);
title(‘Cumulative Singular Entropy vs. Component Index’);
grid on;

% Calculate the point where entropy stabilizes
entropy_diff = diff(cumulative_entropy); % Difference between consecutive entropy values
threshold = 0.01; % Threshold to detect stabilization
stable_point = find(entropy_diff < threshold, 1);

% Mark the stabilization point
hold on;
xline(stable_point + 1, ‘–r’, [‘Stabilization Point: ‘, num2str(stable_point + 1)]);
legend(‘Cumulative Singular Entropy’, ‘Stabilization Point’);

% Number of components based on entropy stabilization
num_components = stable_point + 1;
disp([‘Number of components based on entropy stabilization: ‘, num2str(num_components)]);

% Reconstruct the signal by categorizing components
trend_indices = 1; % Trend corresponds to the first component
oscillation_indices = 2:num_components; % Oscillations from second component to stabilization point
noise_indices = (num_components + 1):length(S); % Noise corresponds to components after stabilization

% Reconstruct signals based on selected indices
trend_signal = reconstruct_signal(U, S, V’, trend_indices, length(signal));
oscillation_signal = reconstruct_signal(U, S, V’, oscillation_indices, length(signal));
noise_signal = reconstruct_signal(U, S, V’, noise_indices, length(signal));

% Plot the original signal, Trend, Oscillations, and Noise
figure;
plot(signal, ‘b’, ‘DisplayName’, ‘Original Signal’, ‘LineWidth’, 1.5);
hold on;
plot(trend_signal, ‘g’, ‘DisplayName’, ‘Trend’, ‘LineWidth’, 1.5);
plot(oscillation_signal, ‘orange’, ‘DisplayName’, ‘Oscillations’, ‘LineWidth’, 1.5);
plot(noise_signal, ‘r’, ‘DisplayName’, ‘Noise’, ‘LineWidth’, 1.5);
title(‘Signal Decomposition’);
xlabel(‘Time’);
ylabel(‘Amplitude’);
legend;
grid on; singular spectrum analysis, ssa, entropy, signal d MATLAB Answers — New Questions

​

Tags: matlab

Share this!

Related posts

How to debug C# .NET assembly called from MATLAB?
2025-05-15

How to debug C# .NET assembly called from MATLAB?

How do I set the size of a tile from tiledlayout?
2025-05-15

How do I set the size of a tile from tiledlayout?

Communicate with worker through client
2025-05-15

Communicate with worker through client

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