# Deconvolution results a single value

11 views (last 30 days)
lakshitha Lathpandura on 6 Feb 2023
Commented: John D'Errico on 7 Feb 2023
Hi There!
I am implementing a MATLAB code for the deconvolution of a spectrum. Initially, I am testing my code on the data provided in a published paper.
According to the text mentioned above, by deconvoluting the Fermi function (represented by the dash line, 'Fermi_func' in the MATLAB code), from the spectrum (represented by the black open circles, 'Spectra' in the code), I should obtain the instrumental function, which is represented by a solid line and is a Gaussian function with a width of 0.55 eV.
I digitized the spectrum in the paper (data.txt file attached) and wrote a MATLAB code for its deconvolution (deconvolution.m file attached). However, I am now getting a single value instead of an array for the instrumental function. I was expecting a Gaussian function. I'm not sure what's going wrong.
I am new to MATLAB and any advice regarding this issue would be highly appreciated.
Thank You.
Lakshitha
===============================
Implemented MATLAB code is given below (the .m file is also attached):
clear all;
close all;
clc
Energy = A(:,1);
Spectrum = A(:,2);
Fermi_func = 1-(1./(1+exp((Energy-8.18)/0.025852)));
Fermi_func(1)= 1e-6; % I got an error from deconv that "First coefficient must be non-zero". So I replaced it with a very small value.
Instrumental_Function = deconv(Spectrum,Fermi_func);
% Instrumental_Function =
% deconv(Counts(find(Counts,1):end),Fermi_func(find(Fermi_func,1):end)) %
% This was also implemeted for removing the error of "First coefficient must be non-zero".
display(Instrumental_Function)
f1 = figure('Name','Inverse Photoemission Spectroscopy Fitting');
h1 = plot(Energy, Spectrum,'ko');
hold on;
xlabel('Energy (eV)')
ylabel('Counts (arb. units)')
h2 = plot(Energy, Fermi_func,'k--');
% h3 = plot(Energy, Instrumental_Function,'k-');
hold off;
savefig(f1,'IPES_Fitting.fig')

John D'Errico on 6 Feb 2023
Convolution of two vectors yields a new vector that is longer than either of them. So if the vectors have length N and M, then the convolved result will have length N+M-1. For example,
X = rand(1,10);
Y = [1 2 1]/4;
Z = conv(X,Y);
numel(Z)
ans = 12
Deconvolution does the opposite. It produces a shorter vector.
Xhat = deconv(Z,Y);
plot(X,'-rx')
hold on
plot(Xhat,'-bo')
As you can see, the deconvolution yields a result that is shorter than the vector Z. The deconvolved result of deconv(Z,Y) will have length
length(Z) - length(Y) + 1
ans = 10
This is as expected. However, IF you perform a deconvolution, where the two vectors have the same lengths, then the result will have length 1. For example...
deconv(randn(1,10),randn(1,10))
ans = -0.0278
So it will be a scalar result. And that makes complete sense. Did you not get a scalar result in what you did?
John D'Errico on 7 Feb 2023
Deconvolution is a difficult problem. It can be ill-posed, which suggests it will be difficult to solve.

### Categories

Find more on Mathematics in Help Center and File Exchange

R2022b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by