Wednesday, March 8, 2017

Breadboard Layout


The first lab of the course is testing the layout of our solderless breadboards. We proceed by measuring the resistance between various contacts.

 Across a row, resistance is small but nonzero.

Resistance is zero across rows on either side of the breadboard, as well
as between adjacent rows and between rows and the side rails.

 There is a small resistance between contacts along a rail,
but not between two rails.

Summary

Lack of resistance indicates an open circuit and small resistance a closed circuit. The measurements show that the breadboard is laid out in a fashion ideal for the construction of circuits. Contacts within a row are joined, allowing each row to act as a node. Adjacent rows are separated, allowing devices to sit between them. Each rail has common contacts but is separate from the others, ideal for accessing a connected voltage source and ground or even input and output signals.

Tuesday, March 7, 2017

Matlab


Simultaneous Equations

Theory

I1 = I2 + I3

V1 = I1R1 + I3R3
V2 = I2R2 - I3R3

V1 = (I2 + I3)R1 + I3R3
V2 = I2R2 - I3R3

|R1 R1+R3||I2| |V1|
|R2  -R3 ||I3|=|V2|

Computation

I = inv([20 30; 5 -10])*[15; 7]

I =
    1.0286
   -0.1857

I3 = -0.1857A



Plotting Exponentials

1.

tau1=100; tau2=200; t=linspace(0, 5*tau2); circA=2*exp(-t/tau1); circB=2*exp(-t/tau2);
plot(t,circA,t,circB)



Circuit A has faster response.

2.

tau1=100; tau2=200; t=linspace(0, 5*tau2); circA=2*(1-exp(-t/tau1)); circB=2*(1-exp(-t/tau2));
plot(t,circA,t,circB)





Adding Sinusoids

1. Theory



Where b = pi/36, a = pi/12, B = 3, A = 5

Computation

omega=2; amp1=3; amp2=5; phase1=10; phase2=30; t=linspace(0,(4*pi)/omega,500);
conver=(2*pi)/(360*omega);
f1=amp1*sin(omega*t+phase1*conver);
f2=amp2*cos(omega*t+phase2*conver);
fnet = f1+f2;
plot(t,f1,t,f2,t,fnet)



2.

freq=10; omega=2*pi*freq; amp1=3; amp2=5; phase1=10; phase2=30;
t=linspace(0,(4*pi)/omega,500); conver=(2*pi)/(360*omega);
f1=amp1*sin(omega*t+phase1*conver);
f2=amp2*cos(omega*t+phase2*conver);
fnet = f1+f2;
plot(t,f1,t,f2,t,fnet)





Complex Numbers

1. Theory

C = (A1 x B) / A2 = [(3*2-2*(-2)) + j((3+2)(2-2)-(3*2+2*(-2)))] / A2 = (10-j2) / A2
= (10*(-1)+(-2)*4)+j((-2)*(-1)-10*4)) / ((-1)^2+4^2) = -18/17 j(-38/17) = -1.059 - j2.235

Computation

A1=3+2j; A2=-1+4j; B=2-2j;
C=(A1*B)/A2

C =
  -1.0588 -  2.2353i

2.

Polar to Rectangular
rect=polMag*exp(j*polPhase*pi/180)

Rectangular to Polar
polPhase=angle(rect)*180/pi
polMag=abs(rect)

rect =
   3.0000 +  2.0000i
polPhase =
   33.6901
polMag =
    3.6056

rect =
  -1.0000 +  4.0000i
polPhase =
  104.0362
polMag =
    4.1231

rect =
   2.0000 -  2.0000i
polPhase =
 -45
polMag =
    2.8284

rect =
  -1.0588 -  2.2353i
polPhase =
 -115.3462
polMag =
    2.4734

3.1 Theory

D = (A1 + B)*A2 = 5(-1+j4) = -5+j20

Computation

D=(A1+B)*A2

D =
  -5.0000 + 20.0000i

3.2

rect =
  -5.0000 + 20.0000i
polPhase =
  104.0362
polMag =
   20.6155

4.

I=inv([8+8j, 2j; 2j, 4-4j])*[50j; -30j];

rect =
   2.0588 +  2.9412i
   5.0000 -  3.5294i
polPhase =
   55.0080
  -35.2176
polMag =
    3.5902
    6.1202



Roots

1.

p=[1 1 4]; r=roots(p)

r =
  -0.5000 +  1.9365i
  -0.5000 -  1.9365i

p=[1 3 0 3]; r=roots(p)

r =
  -3.2790 +  0.0000i
   0.1395 +  0.9463i
   0.1395 -  0.9463i

p=[1 3 4 2 7]; r=roots(p)

r =
  -1.8222 +  1.2680i
  -1.8222 -  1.2680i
   0.3222 +  1.1474i
   0.3222 -  1.1474i

2.

p=[1 5 7 3]; r=roots(p)

r =
  -3.0000 +  0.0000i
  -1.0000 +  0.0000i
  -1.0000 -  0.0000i

F(s) = (s+7)/[(s+3)(s+1)^2] = C1/(s+3) + C2/(s+1) + C3/(s+1)^2

s+7 = C1(s+1)^2 + C2(s+1)(s+3) + C3(s+3)

0 = C1 + C2
1 = 2C1 + 4C2 + C3
7 = C1 + 3C2 + 3C3

C = inv([1 1 0; 2 4 1; 1 3 3])*[0; 1; 7]

C =
  1
 -1
  3

f(t) = e^(-3t) - e^(-t) + 3e^(-t)