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

61 ビュー (過去 30 日間)
ekagra gupta
ekagra gupta 2022 年 8 月 23 日
コメント済み: Florian Bittner 2023 年 9 月 21 日
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 Center および File ExchangeSpectral Measurements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by