Bläddra i källkod

RLC_script completed

publish
Wouter Horlings 8 år sedan
förälder
incheckning
ed9edaa72e
4 ändrade filer med 15 tillägg och 4 borttagningar
  1. Binär
      OOequipment/RLC_TransferFunction.mlx
  2. +3
    -0
      OOequipment/subfiles/RC_TransferFunction_script.m
  3. +11
    -3
      OOequipment/subfiles/RLC_TransferFunction_script.m
  4. +1
    -1
      OOequipment/subfiles/phamag.m

Binär
OOequipment/RLC_TransferFunction.mlx Visa fil


+ 3
- 0
OOequipment/subfiles/RC_TransferFunction_script.m Visa fil

@@ -1,6 +1,9 @@
%% Run the measurements
data = transferFunction(oscilloscope,functiongenerator,f_start,f_stop,n_steps,amplitude);

%% plot the data
S = asymptote(S_smaller,S_larger,f,Fc);
P = mod(P,pi);
figure;
subplot(2,1,1)
semilogx(data.frequency,data.magnitude,f,A,f,S)


+ 11
- 3
OOequipment/subfiles/RLC_TransferFunction_script.m Visa fil

@@ -1,16 +1,24 @@
%% Run the measurements
data = transferFunction(oscilloscope,functiongenerator,f_start,f_stop,n_steps,amplitude);
%% plot the data
S = asymptote(S_smaller,S_larger,f,Fc);
P = mod(P,pi);
figure;
subplot(2,1,1)
semilogx(data.frequency,data.magnitude,f,A,f,S)
semilogx(data.frequency,data.magnitude)
hold on
semilogx(f,A,f,S)
hold off
ylabel('Magnitude [dB]','Fontsize',10);
xlabel('Frequency [Hz]','Fontsize',10);
legend('Measurement','Theory','Asymptote');
grid on
title('RC-circuit Bodeplot')
title('RLC-circuit Bodeplot')
subplot(2,1,2);
semilogx(data.frequency,data.phase,f,P)
semilogx(data.frequency,data.phase)
hold on
semilogx(f,P)
hold off
ylabel('Phase [rad]','Fontsize',10);
xlabel('Frequency [Hz]','Fontsize',10);
legend('Measurement','Theory');

+ 1
- 1
OOequipment/subfiles/phamag.m Visa fil

@@ -7,7 +7,7 @@ Fs = 1/T;
n = 2^nextpow2(length);
X = fft(wave,n,2)/n;
idx = ceil(frequency*n/Fs);
phase = mod(angle(mean(X(2,idx)))-angle(mean(X(1,idx)))+pi,2*pi)-pi;
phase = mod(angle(mean(X(2,idx)))-angle(mean(X(1,idx))),pi);
magnitude = 20*log10(abs(X(2,idx))/abs(X(1,idx)));
end


Laddar…
Avbryt
Spara