# R script
# select curves for the npn heater circuit
# vgoffin
# Tue Mar 13 09:10:05 EST 2001
vc <- 12 # supply
vbe <- 0.6 # base-emitter drop -- when conducting
v1 <- (1:12) # input
rr <- 25 # load
rb <- 0 # base resistor
hfe <- 50 # transistor beta
ib <- (v1 - vbe)/(rb + rr*hfe)
vb <- v1 - ib*rb
ve <- vb - vbe
ie <- ve/rr
ic <- ie - ib
vce <- vc - ve
wce <- vce*ic
wrr <- ve*ie
data <- matrix(c((wce+wrr), wce, wrr), ncol=3)
col <- c("blue", "red", "black")
matplot(v1, data, type="l", lty=1, col=col, xlab="Vin", ylab="Watts")
#abline(h=1)
#abline(h=0.7)
x <- max(v1) * c(0.1, 0.6)
y <- max(c(wce, wrr))*c(1, 0.8)
txt <- c("Wtotal", "Wtrans", "Wres")
legend(x, y, txt, lty=1, col=col)