Deconvolution of a polynomial and exponential function
12 views (last 30 days)
Show older comments
I got the same problem with following link:
I got trouble using Bayesian deconvolution
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/922689/image.png)
here I already got wt(z) and a'(z) with same one dimension size array
I have no idea how to got iterative.
If need my data, I will give my data. thanks a lot ><
4 Comments
高飞 支
on 17 Dec 2023
Moved: John D'Errico
on 17 Dec 2023
I have the same trouble have you solved it?can you give me some advices?
Rui
on 6 Aug 2024
hello, larry liu
i am doing the same work as you did, did u use the Bayes iteration that you showed in the picture? cuz i try to deal with time constant in this way. It doesn't work..
Answers (1)
Yash
on 24 Nov 2023
Edited: Yash
on 24 Nov 2023
Hi Larry,
I understand that you are facing issues while using the "deconv" function in MATLAB. "deconv(y,h)" deconvolves a vector "h" out of a vector "y" using polynomial long division, and returns the quotient "x" and remainder "r" such that "y = conv(x,h) + r".
Given that you already have a deconvolution function in your case, you may not need to use the "deconv" function. Instead, you can make an initial guess for "R(z)" and then obtain the approximation iteratively using a loop as follows:
n = length(df2);
w = Wzinstead';
a = df2';
R = randi(1000,n,1)/1000; % Initial guess, random values
nIter = 10;
for i=1:1:nIter
R1=R*(corr(w, a./(conv(w,R,'same'))));
R=R1;
end
Hope this helps you address the issue.
1 Comment
yicong
on 6 Sep 2024
% Define initial parameters
R1 = 6.3;
R2 = 6.3;
R3 = 6.3;
tau1 = 1e-5;
tau2 = 1e-2;
tau3 = 1e1;
% Define the time range
t_min = 1e-6;
t_max = 1e2;
% Calculate the number of interpolation points
num_points_per_decade = 20;
num_decades = log10(t_max) - log10(t_min);
num_points = round(num_points_per_decade * num_decades);
% Generate logarithmically spaced time points
t_interp = logspace(log10(t_min), log10(t_max), num_points);
z_interp = log(t_interp);
% Calculate the analytical model a(t)
a_t = R1 * (1 - exp(-exp(log(t_interp))/tau1)) + ...
R2 * (1 - exp(-exp(log(t_interp))/tau2)) + ...
R3 * (1 - exp(-exp(log(t_interp))/tau3));
% Use gradient to compute da/dz
da_dz = gradient(a_t, z_interp);
% Define W(z) = exp(z - exp(z))
W_z = exp(z_interp - exp(z_interp));
% Uncomment to normalize each column of W_z
% for l = 1:num_points
% W_z(:, l) = W_z(:, l) / sum(W_z(:, l)); % Normalize each column
% end
max_iterations = 100; % Maximum number of iterations
tolerance = 1e-6; % Convergence threshold
% Initialize Psi(z) with da/dz
Psi_z = da_dz';
w=W_z';
a=da_dz';
% Iterative correction
for iter = 1:1:max_iterations
R1=Psi_z*(corr(w, a./(conv(w,Psi_z,'same'))));
Psi_z=R1;
end
% Plot the results
figure;
subplot(3,1,1);
plot(z_interp, da_dz);
title('da/dz vs z');
xlabel('z');
ylabel('da/dz');
subplot(3,1,2);
plot(z_interp, W_z);
title('W(z)');
xlabel('z');
ylabel('W(z)');
subplot(3,1,3);
plot(z_interp, Psi_z);
title('\Psi(z) after Van Cittert Deconvolution');
xlabel('z');
ylabel('\Psi(z)');
-----------
I apply your code here while get wrong time constant result.
See Also
Categories
Find more on Polynomials in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!