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

조회 수: 59 (최근 30일)
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
  댓글 수: 1
ekagra gupta
ekagra gupta 2022년 8월 23일
? I know using FFT but it would be great if someone would rpovide some code to follow up

댓글을 달려면 로그인하십시오.

채택된 답변

Mathieu NOE
Mathieu NOE 2022년 8월 24일
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
Ruben Messner
Ruben Messner 2023년 8월 7일
hi,
could you share your final solution by chance? I'm trying to do the same calc...
Thx in advance!
Florian Bittner
Florian Bittner 2023년 9월 21일
Hi, guys i also try to analyse the battery voltage using fft. Do you guys found a working code/solution?
Thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by