Products > Test Equipment
LCR Impedance Viewer for Picoscope+Keysight+R&S Bode Plot Data (open source)
HalFET:
To further elaborate on it, since you're using gain apparently (assuming I read your code correctly) we'll have to convert the scope's measurement error to gain error:
Gain = 20 log(V1/V2)
dGain/dV1 = - 20 / V1
dGain/dV2 = 20 / V2
So then:
Gain Error = sqrt( (dGain/dV1 * V1_Error)^2 + (dGain/dV2 * V2_Error)^2 )
Gain Error = sqrt( (20 / V1 * V1_Error)^2 + (20 / V2 * V2_Error)^2 )
Gain Error = 20 * sqrt( (V1_Error / V1)^2 + (V2_Error / V2)^2 )
Next we need to put this into Z_DUT = Z_REF * V1 / (V2 - V1)
If we rework it a bit it should become Z_DUT = Z_REF / (V2 / V1 - 1) = Z_REF / (1 / (V1/V2) - 1)
Then V1/V2 = (|V1| < Phi)/(V2 < 0°) = (|V1| * cos(phi) + j * |V1| * sin(phi)) / |V2| so we need to know the error on |V1|/|V2|.
Since |V1|/|V2| = 10^(Gain/20) the error becomes sqrt((Gain Error * 2^((x-40)/20) * 5^((x-20)/20) * ln(10))^2)
I'll do the rest later.
_Wim_:
--- Quote from: HalFET on February 28, 2019, 01:14:20 pm ---To further elaborate on it, since you're using gain apparently (assuming I read your code correctly) we'll have to convert the scope's measurement error to gain error:
Gain = 20 log(V1/V2)
dGain/dV1 = - 20 / V1
dGain/dV2 = 20 / V2
So then:
Gain Error = sqrt( (dGain/dV1 * V1_Error)^2 + (dGain/dV2 * V2_Error)^2 )
Gain Error = sqrt( (20 / V1 * V1_Error)^2 + (20 / V2 * V2_Error)^2 )
Gain Error = 20 * sqrt( (V1_Error / V1)^2 + (V2_Error / V2)^2 )
Next we need to put this into Z_DUT = Z_REF * V1 / (V2 - V1)
If we rework it a bit it should become Z_DUT = Z_REF / (V2 / V1 - 1) = Z_REF / (1 / (V1/V2) - 1)
Then V1/V2 = (|V1| < Phi)/(V2 < 0°) = (|V1| * cos(phi) + j * |V1| * sin(phi)) / |V2| so we need to know the error on |V1|/|V2|.
Since |V1|/|V2| = 10^(Gain/20) the error becomes sqrt((Gain Error * 2^((x-40)/20) * 5^((x-20)/20) * ln(10))
I'll do the rest later.
--- End quote ---
Wow, thanks for this. I will have a detailed look at it this weekend, to late for math now... :)
_Wim_:
New version in first post:
Bugfix:
- was not possible any longer to open multiple FRA4Pico plots (was always opening new plot).
Other changes:
- cursor info always same nr of lines (so chart does not move when right mouse button is used)
- pompt on exit when unsaved files are present
HalFET:
--- Quote from: HalFET on February 28, 2019, 01:14:20 pm ---To further elaborate on it, since you're using gain apparently (assuming I read your code correctly) we'll have to convert the scope's measurement error to gain error:
Gain = 20 log(V1/V2)
dGain/dV1 = - 20 / V1
dGain/dV2 = 20 / V2
So then:
Gain Error = sqrt( (dGain/dV1 * V1_Error)^2 + (dGain/dV2 * V2_Error)^2 )
Gain Error = sqrt( (20 / V1 * V1_Error)^2 + (20 / V2 * V2_Error)^2 )
Gain Error = 20 * sqrt( (V1_Error / V1)^2 + (V2_Error / V2)^2 )
Next we need to put this into Z_DUT = Z_REF * V1 / (V2 - V1)
If we rework it a bit it should become Z_DUT = Z_REF / (V2 / V1 - 1) = Z_REF / (1 / (V1/V2) - 1)
Then V1/V2 = (|V1| < Phi)/(V2 < 0°) = (|V1| * cos(phi) + j * |V1| * sin(phi)) / |V2| so we need to know the error on |V1|/|V2|.
Since |V1|/|V2| = 10^(Gain/20) the error becomes sqrt((Gain Error * 2^((x-40)/20) * 5^((x-20)/20) * ln(10))^2)
I'll do the rest later.
--- End quote ---
Fixed a little error, forgot the ^2 on the ratio of |V1|/|V2| error, but I'd just replace it with abs() in software. Also didn't remember that cos(x) + j*sin(x) = e^(j*x).
The error on V1/V2 then becomes:
d(V1/V2)/d(|V1|/|V2|) = exp(j*phi)
d(V1/V2)/d(phi) = (|V1|/|V2|)*exp(j*(phi+0.5*pi))
Error V1/V2 = sqrt((d(V1/V2)/d(|V1|/|V2|) * Error(|V1|/|V2|))^2 + (d(V1/V2)/d(phi) * Error(Phi))
HalFET:
Redid it entirely in Matlab to avoid errors (think a few might have sneaked in already, like I forgot a ln(10) in the gain error probably):
--- Code: ---syms REF_Magnitude positive; syms Error_REF_Magnitude positive;
syms REF_Phi real; syms Error_REF_Phi positive;
syms V1_Magnitude positive; syms Error_V1_Magnitude positive;
syms V1_Phi real; syms Error_V1_Phi positive;
syms V2_Magnitude positive; syms Error_V2_Magnitude positive;
%Calculate Gain error based on scope measurements
%This should be a function of the scope which is calculated once.
TrueGain = 20 * log10(V1_Magnitude / V2_Magnitude);
dGain_dV1 = diff(TrueGain, V1_Magnitude);
dGain_dV2 = diff(TrueGain, V2_Magnitude);
TrueGain_Error = sqrt( (dGain_dV1 * Error_V1_Magnitude)^2 + (dGain_dV2 * Error_V2_Magnitude)^2 );
%Lets assume the Gain and Gain_Error are input variables
syms Gain Gain_Error real;
%Calculate V1/V2 error based on Gain error
V1_V2_Magn_ratio = 10 ^ (Gain / 20);
Error_V1_V2_Magn_ratio = abs(diff(V1_V2_Magn_ratio, Gain) * Gain_Error);
V1_V2 = V1_V2_Magn_ratio * exp(1i * V1_Phi);
dV1_V2_dGain = diff(V1_V2, Gain);
dV1_V2_dV1_Phi = diff(V1_V2, V1_Phi);
V1_V2_Error = sqrt(( dV1_V2_dGain * Gain_Error)^2 + (dV1_V2_dV1_Phi * Error_V1_Phi)^2);
%Device Under Test
Z_REF = REF_Magnitude * exp(1i * REF_Phi);
Z_DUT = Z_REF * 1 / (1 / V1_V2 - 1);
Z_DUT_Magnitude = abs(Z_DUT);
Z_DUT_Phase = angle(Z_DUT);
Z_DUT_Magnitude_deltas = [diff(Z_DUT_Magnitude, REF_Magnitude) diff(Z_DUT_Magnitude, REF_Phi) diff(Z_DUT_Magnitude, Gain) diff(Z_DUT_Magnitude, V1_Phi)];
Z_DUT_Magnitude_errors = [Error_REF_Magnitude Error_REF_Phi Gain_Error Error_V1_Phi];
Z_DUT_Phase_deltas = [diff(Z_DUT_Phase, REF_Magnitude) diff(Z_DUT_Phase, REF_Phi) diff(Z_DUT_Phase, Gain) diff(Z_DUT_Phase, V1_Phi)];
Z_DUT_Phase_errors = [Error_REF_Magnitude Error_REF_Phi Gain_Error Error_V1_Phi];
Z_DUT_Magnitude_Error = sqrt(sum((Z_DUT_Magnitude_deltas .* Z_DUT_Magnitude_errors).^2));
Z_DUT_Phase_Error = sqrt(sum((Z_DUT_Phase_deltas .* Z_DUT_Phase_errors).^2));
--- End code ---
--- Code: ---Z_DUT_Magnitude = REF_Magnitude/abs(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1)
Z_DUT_Phase = angle(exp(REF_Phi*1i)/(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1))
Z_DUT_Magnitude_Error = (Error_REF_Magnitude^2/abs(exp(-V1_Phi*1i)/10^(Gain/20) - 1)^2 - (1/10^(Gain/10)*Error_V1_Phi^2*REF_Magnitude^2*sign(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1)^2*exp(-V1_Phi*2i))/abs(exp(-V1_Phi*1i)/10^(Gain/20) - 1)^4 + (1/10^(Gain/10)*Gain_Error^2*REF_Magnitude^2*sign(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1)^2*exp(-V1_Phi*2i)*log(10)^2)/(400*abs(exp(-V1_Phi*1i)/10^(Gain/20) - 1)^4))^(1/2)
Z_DUT_Phase_Error = ((Gain_Error^2*real(exp(REF_Phi*1i)/(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1))^4*(imag((1/10^(Gain/20)*exp(REF_Phi*1i)*exp(-V1_Phi*1i)*log(10))/(exp(-V1_Phi*1i)/10^(Gain/20) - 1)^2)/(20*real(exp(REF_Phi*1i)/(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1))) - (real((1/10^(Gain/20)*exp(REF_Phi*1i)*exp(-V1_Phi*1i)*log(10))/(exp(-V1_Phi*1i)/10^(Gain/20) - 1)^2)*imag(exp(REF_Phi*1i)/(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1)))/(20*real(exp(REF_Phi*1i)/(exp(-V1_Phi*1i)/10^(Gain/20) - 1))^2))^2)/(imag(exp(REF_Phi*1i)/(exp(-V1_Phi*1i)/10^(Gain/20) - 1))^2 + real(exp(REF_Phi*1i)/(exp(-V1_Phi*1i)/10^(Gain/20) - 1))^2)^2 + (Error_V1_Phi^2*real(exp(REF_Phi*1i)/(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1))^4*(real((1/10^(Gain/20)*exp(REF_Phi*1i)*exp(-V1_Phi*1i))/(exp(-V1_Phi*1i)/10^(Gain/20) - 1)^2)/real(exp(REF_Phi*1i)/(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1)) + (imag((1/10^(Gain/20)*exp(REF_Phi*1i)*exp(-V1_Phi*1i))/(exp(-V1_Phi*1i)/10^(Gain/20) - 1)^2)*imag(exp(REF_Phi*1i)/(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1)))/real(exp(REF_Phi*1i)/(exp(-V1_Phi*1i)/10^(Gain/20) - 1))^2)^2)/(imag(exp(REF_Phi*1i)/(exp(-V1_Phi*1i)/10^(Gain/20) - 1))^2 + real(exp(REF_Phi*1i)/(exp(-V1_Phi*1i)/10^(Gain/20) - 1))^2)^2 + (Error_REF_Phi^2*real(exp(REF_Phi*1i)/(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1))^4*(imag(exp(REF_Phi*1i)/(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1))^2/real(exp(REF_Phi*1i)/(exp(-V1_Phi*1i)/10^(Gain/20) - 1))^2 + 1)^2)/(imag(exp(REF_Phi*1i)/(exp(-V1_Phi*1i)/10^(Gain/20) - 1))^2 + real(exp(REF_Phi*1i)/(exp(-V1_Phi*1i)/10^(Gain/20) - 1))^2)^2)^(1/2)
--- End code ---
This isn't very practical though, the question is where to start simplifying. Or better yet, what's an acceptable error estimate. The flu hit me a bit too hard for me to think straight about this one for now, heheh.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version