mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2026-04-09 00:13:59 +00:00
feat: add format quality factor
This commit is contained in:
parent
64de4d5d87
commit
bc1b57c3f0
4 changed files with 31 additions and 9 deletions
19
plot.c
19
plot.c
|
|
@ -491,6 +491,14 @@ reactance(const float *v)
|
|||
return zi;
|
||||
}
|
||||
|
||||
static float
|
||||
qualityfactor(const float *v)
|
||||
{
|
||||
float i = 2*v[1];
|
||||
float r = (1+v[0])*(1-v[0]) - v[1]*v[1];
|
||||
return fabs(i / r);
|
||||
}
|
||||
|
||||
static void
|
||||
cartesian_scale(float re, float im, int *xp, int *yp, float scale)
|
||||
{
|
||||
|
|
@ -567,6 +575,9 @@ trace_into_index(int t, int i, float array[POINTS_COUNT][2])
|
|||
case TRC_X:
|
||||
v-= reactance(coeff) * scale;
|
||||
break;
|
||||
case TRC_Q:
|
||||
v-= qualityfactor(coeff) * scale;
|
||||
break;
|
||||
case TRC_SMITH:
|
||||
//case TRC_ADMIT:
|
||||
case TRC_POLAR:
|
||||
|
|
@ -669,6 +680,10 @@ trace_get_value_string(int t, char *buf, int len, float array[POINTS_COUNT][2],
|
|||
format = "%.2F"S_OHM;
|
||||
v = gamma2reactance(coeff);
|
||||
break;
|
||||
case TRC_Q:
|
||||
format = "%.1f";
|
||||
v = qualityfactor(coeff);
|
||||
break;
|
||||
case TRC_SMITH:
|
||||
format_smith_value(buf, len, coeff, frequencies[i]);
|
||||
return;
|
||||
|
|
@ -729,6 +744,10 @@ trace_get_value_string_delta(int t, char *buf, int len, float array[POINTS_COUNT
|
|||
format = "%.2F"S_OHM;
|
||||
v = gamma2reactance(coeff);
|
||||
break;
|
||||
case TRC_Q:
|
||||
format = "%.1f";
|
||||
v = qualityfactor(coeff);
|
||||
break;
|
||||
//case TRC_ADMIT:
|
||||
case TRC_POLAR:
|
||||
plot_printf(buf, len, "%.2f%+.2fj", coeff[0], coeff[1]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue