%Lab202 Exp 3 Phase shifter
R = 15915.5;  C = 0.01e-6;
f = [250 500 750 1000 1500 2000 3000 4000 5000]';	
                     % Generates a column array for selected f in Hz
%f = (0:1:5000)';               % Uncomment and run to get smooth plots
w = 2*pi*f;                     % Frequency array in Rad/sec
g = 1 ./(1-w.^2*R^2*C^2 + j*3*w*R*C);
mag = abs(g);                   % Voltage gain magnitude 
phase = angle(g)*180/pi;        % Phase angle in degree
result=[f mag phase];           % Augment the variables 
format short g                  % General format
fprintf('Your Name \n')
fprintf('Results for circuit in Figure 2 \n\n')
disp(['          f-Hz     |V2/V1|       Angle'])  % display a heading 
disp(result)                    % display the result 
subplot(2,1,1), plot(f,mag),grid
xlabel('f, Hz'),ylabel('Magnitude')
subplot(2,1,2),plot(f,phase),grid
xlabel('f, Hz'),ylabel('\theta, degree')

