Energy calculation via current signal integration with limits

35 ビュー (過去 30 日間)
Akhtar Rind
Akhtar Rind 2020 年 7 月 2 日
コメント済み: Star Strider 2020 年 7 月 2 日
I want to calculate Energy during applied voltage and recieved current pulse signal at given time
data=load('data.txt'); % Pulse data
T=data(:,1); % Time vector
V=data(:,2); % Voltage in volts
I=data(:,3); %Current in Amp
iVs= find(T>=0,1,'first'); % Voltage/Pulse Signal start index
Vmx=V(iVs); % Value of voltage at signal/pulse start time
iVe=find(T>0 & V<=(Vmx/4),1,'last'); % End of signal/voltage index
w=round((T(iVe)-T(iVs))*1E6); % Pulse width or duration in micro sec
P=I.*V; % Power pulse
% Now we have time, Voltage, Current, start and end time of pulse/signal
% What is enegry delivered in pulse duration (Zero to 43 micro-sec)
% Formula =
Somehow I struglling to apply intergration with time limits ?

採用された回答

Star Strider
Star Strider 2020 年 7 月 2 日
Add this after your posted code:
idxrng = iVs:iVe;
IntP = cumtrapz(T(idxrng), P(idxrng));
figure
subplot(3,1,1)
yyaxis left
plot(T, V)
ylabel('V')
yyaxis right
plot(T, I)
ylabel('I')
grid
subplot(3,1,2)
plot(T, P)
ylabel('P')
grid
subplot(3,1,3)
plot(T(idxrng), IntP)
text(T(iVe), IntP(end), sprintf('Total Power = %7.3f \n \\downarrow', IntP(end)), 'HorizontalAlignment','right', 'VerticalAlignment','bottom')
ylabel('$\int{P}dt$', 'Interpreter','latex')
grid
producing:
.Add appropriate units (such a ‘VA’) for power.
  4 件のコメント
Akhtar Rind
Akhtar Rind 2020 年 7 月 2 日
Fantastic. It worked. Many thanks.
Star Strider
Star Strider 2020 年 7 月 2 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by