Impedance calculation using FFT from time, voltage and current battery data

60 visualizzazioni (ultimi 30 giorni)
Hello,
I have battery pulse test and pseudo OCV measurements (time, current and voltage) in time domain and I want to obtain plot similar to EIS in freuqnecy domain using Fourier Transform.
Is it possible? If yes, then please explain the approach
Thankyou

Risposta accettata

Mathieu NOE
Mathieu NOE il 24 Ago 2022
hello
should be possible using tfestimate function
alternative (older) code :
x and y are your time domain data (x = input of the system , y = output)
you need to specify the fft buffer length, sampling freq, type of window and overlap (if you want)
%%%%%%%%%%%%%%%%%%%%%%%
function [Txy,Cxy,f] = mytfe_and_coh(x,y,nfft,Fs,window,noverlap)
% Transfer Function and Coherence Estimate
% compute PSD and CSD
window = window(:);
n = length(x); % Number of data points
nwind = length(window); % length of window
if n < nwind % zero-pad x , y if length is less than the window length
x(nwind)=0;
y(nwind)=0;
n=nwind;
end
x = x(:); % Make sure x is a column vector
y = y(:); % Make sure y is a column vector
k = fix((n-noverlap)/(nwind-noverlap)); % Number of windows
% (k = fix(n/nwind) for noverlap=0)
index = 1:nwind;
Pxx = zeros(nfft,1);
Pyy = zeros(nfft,1);
Pxy = zeros(nfft,1);
for i=1:k
xw = window.*x(index);
yw = window.*y(index);
index = index + (nwind - noverlap);
Xx = fft(xw,nfft);
Yy = fft(yw,nfft);
Xx2 = abs(Xx).^2;
Yy2 = abs(Yy).^2;
Xy2 = Yy.*conj(Xx);
Pxx = Pxx + Xx2;
Pyy = Pyy + Yy2;
Pxy = Pxy + Xy2;
end
% Select first half
if ~any(any(imag([x y])~=0)) % if x and y are not complex
if rem(nfft,2) % nfft odd
select = [1:(nfft+1)/2];
else
select = [1:nfft/2+1]; % include DC AND Nyquist
end
Pxx = Pxx(select);
Pyy = Pyy(select);
Pxy = Pxy(select);
else
select = 1:nfft;
end
Txy = Pxy ./ Pxx; % transfer function estimate
Cxy = (abs(Pxy).^2)./(Pxx.*Pyy); % coherence function estimate
f = (select - 1)'*Fs/nfft;
end
  8 Commenti
Ruben Messner
Ruben Messner il 7 Ago 2023
hi,
could you share your final solution by chance? I'm trying to do the same calc...
Thx in advance!
Florian Bittner
Florian Bittner il 21 Set 2023
Hi, guys i also try to analyse the battery voltage using fft. Do you guys found a working code/solution?
Thanks!

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by