% voltage divider vs = input ('Please enter the source voltage: '); Rn = input ('Enter the resistances in the voltage divider circuit: '); Rt = sum(Rn); vn = vs*Rn/Rt; Pn = Rn*vs^2 / Rt^2; It = vs/Rt; Pt = vs*It; table = [ Rn', vn', Pn' ]; disp ('Resistance Voltage Power') disp (' Ohm Volt Watt') disp (table) fprintf ('Loop current = %f A \n', It) fprintf ('Total power dissipated by resistors = %f W \n', Pt)