Block least-squares parameters estimation
5 views (last 30 days)
Show older comments
Hi,
There is a system, which its output is equal y(t) = s(t) + a(t), which a(t) is noise and we want to eliminate it from the output. We now the equation regarding a(t). a(t) = vd.(C(t)*h(t))/(Ci + Cc(t))+D which H(jw) = jw/(k(t)+jw). and we know the range of k(t). I've heard that by using windowing and "block least-squares parameters estimation" I can estimate a(t) in MATLAB. But I don't know the starting point. Could you please introduce me a tutorial or guide me?
Thanks
0 Comments
Answers (1)
Mrutyunjaya Hiremath
on 24 Jul 2023
Estimating a(t) from the output y(t) in the presence of noise can be done using system identification techniques. One approach you can consider is the Least-Squares (LS) method, which aims to minimize the sum of the squared errors between the model prediction and the measured output. This approach can be used with windowing to handle time-varying systems.
Here is a simple code.
% Given system equation: y(t) = s(t) + a(t)
% where a(t) = vd * (C(t) * h(t)) / (Ci + Cc(t)) + D
% and H(jw) = jw / (k(t) + jw)
% Define the system model
% y(t) = s(t) + vd * (C(t) * h(t)) / (Ci + Cc(t)) + D
% Define the range of k(t) and other constants
k_min = 0.1; % Minimum value of k(t)
k_max = 1.0; % Maximum value of k(t)
Ci = 2.0; % Constant Ci
D = 1.0; % Constant D
vd = 0.5; % Constant vd
% Generate sample data for s(t) and y(t)
t = 0:0.1:10; % Time vector
s = sin(t); % Sample input signal s(t)
a = vd * (cos(t) ./ (Ci + t)); % True noise signal a(t)
y = s + a; % Measured output y(t)
% Windowing and LS Parameter Estimation
block_size = 5; % Block size for windowing
num_blocks = length(t) / block_size;
estimated_a = zeros(size(t));
for i = 1:num_blocks
block_start = (i - 1) * block_size + 1;
block_end = i * block_size;
block_t = t(block_start:block_end);
block_y = y(block_start:block_end);
% Define the model for the block
model = @(params, t) params(1) * (cos(t) ./ (params(2) + t)) + params(3);
% Set up the LS problem
ls_problem = @(params) block_y - (s(block_start:block_end) + model(params, block_t));
initial_params = [vd, k_min, D]; % Initial guess for parameters
% Solve the LS problem using lsqnonlin
estimated_params = lsqnonlin(ls_problem, initial_params);
% Store the estimated a(t) for this block
estimated_a(block_start:block_end) = model(estimated_params, block_t);
end
% Plot the results
figure;
plot(t, a, 'b', 'LineWidth', 2); % True noise signal a(t)
hold on;
plot(t, estimated_a, 'r', 'LineWidth', 2); % Estimated noise signal a(t)
legend('True a(t)', 'Estimated a(t)');
xlabel('Time t');
ylabel('a(t)');
title('True vs. Estimated Noise Signal a(t)');
% Note: This is a simplified example, and you may need to adjust the model and
% LS problem based on the specific characteristics of your system and data.
0 Comments
See Also
Categories
Find more on Linear Model Identification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!