# Octave half wave hw3

Oct 12th, 2016
150
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. %Octave
2.
3. function hw3(ACrms_in, UdAV, UdAC)
4.
5.     printf("Nilai RMS AC masukan (sumber): %3.3f \n", ACrms_in)
6.     printf("Nilai RMS AC keluaran half-wave: %3.3f \n", UdAC)
7.     printf("Nilai rata-rata DC keluaran half-wave: %3.3f \n", UdAV)
8.
9.
10.     UcRMS_acdc=sqrt((UdAV^2)+(UdAC^2));
11.     printf("Nilai tegangan RMS ac+dc keluaran half-wave rectifier: %3.3f \n", UcRMS_acdc)
12.
13.     ratio1=UdAV/ACrms_in;
14.     printf("Nilai perbandingan tegangan rata-rata (dc) keluaran terhadap nilai RMS AC masukan: %3.3f \n", ratio1)
15.
16.     ratio2=UcRMS_acdc/ACrms_in;
17.     printf("Nilai perbandingan tegangan rms ac+dc keluaran terhadap nilai RMS masukan: %3.3f \n", ratio2)
18.
19.     vin_peak = UdAV*pi;
20.     printf("Nilai tegangan puncak (Vpeak) masukan berdasarkan tegangan rata-rata keluaran (%3.3f) : %3.3f \n", UdAV, vin_peak)
21.
22.     rect_ratio = ((vin_peak/pi)^2/(0.5*vin_peak)^2)*100;
23.     printf("Nilai rectification ratio: %3.3f %% \n", rect_ratio)
24.
25.     form_factor = (UcRMS_acdc)/(UdAV);
26.     printf("Nilai form factor (FF): %3.3f \n", form_factor)
27.
28.     ripple_factor1 = sqrt((form_factor^2)-1);
29.     printf("Nilai ripple factor (RF) cara 1: %3.3f \n", ripple_factor1)
30.
31.     ripple_factor2 = UdAC / UdAV;
32.     printf("Nilai ripple factor (RF) cara 2: %3.3f \n", ripple_factor2)
33. endfunction
34.
35. %hw2(49,21.2,26.2)
36. hw2(12.021,5.4113,6.555)