Browse Source

Fixed some issues with smith and polar plots. Patch from espice


			
			
				pre-master-46
			
			
		
pnenzi 17 years ago
parent
commit
ceecdbf97d
  1. 12
      ChangeLog
  2. 5
      src/frontend/plotting/plotcurv.c
  3. 39
      src/frontend/plotting/plotit.c

12
ChangeLog

@ -1,3 +1,15 @@
2009-01-18 Paolo Nenzi
* src/frontend/plotting/plotit.c,
* src/frontend/plotting/plotcurv.c:
33: Fixed some of the existing problemass SMITH PLOT. There were 2 errors:
one in plotit() to calculate the transformation line (r-1) / (r +1)
where a mistake was made in the process of plotting a single real point
and the other in ft_graf() that would print imaginary part = real part
for real data. A. Roldan - espice
32: Fixed some problems the existing polar PLOT. To summarize the
problems were in the wrong calculation of the size of x and y axes
for the plot. A. Roldan - espice
2009-01-18 Holger Vogt
* src/frontend/mw_coms.c: variable declarations to top of function
* outif.c, alloc.c: add HAS_TCLWIN flag to allow coimpilation of

5
src/frontend/plotting/plotcurv.c

@ -108,9 +108,10 @@ ft_graf(struct dvec *v, struct dvec *xs, bool nostart)
* something useful.
*/
gr_point(v, v->v_realdata[i],
v->v_realdata[i],
0.0, /* v->v_realdata[i], */
v->v_realdata[j],
v->v_realdata[j], (j==i ? 1 : i));
0.0, /* v->v_realdata[j], */
(j==i ? 1 : i));
} else {
gr_point(v, realpart(&v->v_compdata[i]),
imagpart(&v->v_compdata[i]),

39
src/frontend/plotting/plotit.c

@ -707,7 +707,7 @@ plotit(wordlist *wl, char *hcopy, char *devname)
/* Transform for smith plots */
if (gtype == GRID_SMITH) {
double re, im, rex, imx;
double r, i, x;
double r;
struct dvec **prevvp, *n;
int j;
@ -743,12 +743,16 @@ plotit(wordlist *wl, char *hcopy, char *devname)
re = re - 1;
/* (re, im) / (rex, imx) */
x = 1 - (imx / rex) * (imx / rex);
r = re / rex + im / rex * imx / rex;
i = im / rex - re / rex * imx / rex;
realpart(d->v_compdata + j) = r / x;
imagpart(d->v_compdata + j) = i / x;
/* x = 1 - (imx / rex) * (imx / rex);
* r = re / rex + im / rex * imx / rex;
* i = im / rex - re / rex * imx / rex;
*
*
* realpart(d->v_compdata + j) = r / x;
* imagpart(d->v_compdata + j) = i / x;
*/
realpart(d->v_compdata + j) = (rex*re+imx*imx) / (rex*rex+imx*imx);
imagpart(d->v_compdata + j) = (2*imx) / (rex*rex+imx*imx);
}
}
}
@ -762,7 +766,11 @@ plotit(wordlist *wl, char *hcopy, char *devname)
ylims[0] = HUGE;
ylims[1] = - ylims[0];
for (d = vecs; d; d = d->v_link2) {
dd = ft_minmax(d, TRUE);
/* dd = ft_minmax(d, TRUE); */
/* With this we seek the maximum and minimum of imaginary part
* that will go to Y axis
*/
dd = ft_minmax(d, FALSE);
if (dd[0] < ylims[0])
ylims[0] = dd[0];
if (dd[1] > ylims[1])
@ -797,7 +805,11 @@ plotit(wordlist *wl, char *hcopy, char *devname)
xlims[0] = HUGE;
xlims[1] = - xlims[0];
for (d = vecs; d; d = d->v_link2) {
dd = ft_minmax(d, FALSE);
/* dd = ft_minmax(d, FALSE); */
/* With this we seek the maximum and minimum of imaginary part
* that will go to Y axis
*/
dd = ft_minmax(d, TRUE);
if (dd[0] < xlims[0])
xlims[0] = dd[0];
@ -874,8 +886,13 @@ plotit(wordlist *wl, char *hcopy, char *devname)
fabs(xlims[1]);
my = (fabs(ylims[0]) > fabs(ylims[1])) ? fabs(ylims[0]) :
fabs(ylims[1]);
rad = (mx > my) ? mx : my;
/* rad = sqrt(mx * mx + my * my); */
/* rad = (mx > my) ? mx : my; */
/* AM.Roldán
* Change this reason that this was discussed, as in the case of 1 + i want to plot point
* is outside the drawing area so I'll stay as the maximum size of the hypotenuse of
* the complex value
*/
rad = sqrt(mx * mx + my * my);
xlims[0] = - rad;
xlims[1] = rad;
ylims[0] = - rad;

Loading…
Cancel
Save