how I can to get the effective value of voltage(Ture RMS) with the following formula by "for loop"?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
sajad Tarverdian
am 4 Mär. 2022
Kommentiert: sajad Tarverdian
am 5 Mär. 2022
how I can to get the effective value of voltage(Ture RMS) with the following formula by "for loop" and plot it?
like the picture
t=0:0.0001:0.3; f=50Hz Vm=1.4 volt voltage sag=0.2Vm in 0.1<t<0.2
N=100
0 Kommentare
Akzeptierte Antwort
Voss
am 4 Mär. 2022
t = 0:0.0001:0.3;
f = 50; % Hz
Vm = 1.4; % volt
sag = 0.2*Vm; % voltage sag in 0.1<t<0.2
V = Vm*sin(2*pi*f*t);
idx = 0.1<t & t<0.2;
V(idx) = sag/Vm*V(idx);
N = 100;
Vrms = zeros(1,numel(t));
for k = 1:numel(t)
% When k < N, then k-N+1 < 1, which would be indexing before the
% beginning of the vector V. To handle that situation, use max(1,k-N+1)
% as the starting index. This gives the "rising" RMS at t = 0 seen in
% the plot.
Vrms(k) = sqrt(sum(V(max(1,k-N+1):k).^2)/N);
end
plot(t,V);
hold on
plot(t,Vrms,'--r');
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Power Transmission and Distribution finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
