/** * Adds a sequence view with specified sampling and values f(x). * @param sx the sampling of the variable x. * @param f array of sampled function values f(x). * @return the sequence view. */ public SequenceView addSequence(Sampling sx, float[] f) { return addSequence(0,0,sx,f); }
/** * Adds a sequence view with specified values f(x). * Uses default sampling of x = 0, 1, 2, .... * @param f array of sampled function values f(x). * @return the sequence view. */ public SequenceView addSequence(float[] f) { return addSequence(0,0,f); }
/** * Adds a sequence view with specified values f(x). * Uses default sampling of x = 0, 1, 2, .... * @param f array of sampled function values f(x). * @return the sequence view. */ public SequenceView addSequence(float[] f) { return _panel.addSequence(f); }
/** * Adds a sequence view with specified sampling and values f(x). * @param s the sampling of the variable x. * @param f array of sampled function values f(x). * @return the sequence view. */ public SequenceView addSequence(Sampling s, float[] f) { return _panel.addSequence(s,f); }
private static void go() { int nx = 101; float dx = 0.1f; float fx = -0.5f*dx*(float)(nx-1); Sampling sx = new Sampling(nx,dx,fx); float[] f1 = rampfloat(fx,dx,nx); float[] f2 = add(0.5f,sin(f1)); PlotPanel panel = new PlotPanel(2,1); SequenceView sv1 = panel.addSequence(0,0,sx,f1); sv1.setColor(Color.RED); SequenceView sv2 = panel.addSequence(1,0,sx,f2); sv2.setZero(SequenceView.Zero.MIDDLE); PlotFrame frame = new PlotFrame(panel); frame.setDefaultCloseOperation(PlotFrame.EXIT_ON_CLOSE); frame.setSize(950,500); frame.setVisible(true); frame.paintToPng(300,6,"junk.png"); } }
private void updateViews() { Real1 h = computeImpulseResponse(); Real1[] ap = computeAmplitudeAndPhaseResponses(); Real1 a = ap[0]; Real1 p = ap[1]; if (_hView==null) { _hView = _plotPanelH.addSequence(h.getSampling(),h.getValues()); _aView = _plotPanelAP.addPoints(0,0,a.getSampling(),a.getValues()); _pView = _plotPanelAP.addPoints(1,0,p.getSampling(),p.getValues()); } else { _hView.set(h.getSampling(),h.getValues()); _aView.set(a.getSampling(),a.getValues()); _pView.set(p.getSampling(),p.getValues()); } }