Package ptolemy.plot

Examples of ptolemy.plot.Plot$Format


     * the applet can do.
     */
    public void init() {
        super.init();

        Plot plot = (Plot) plot();

        plot.setTitle("Line Plot Demo");
        plot.setYRange(-4, 4);
        plot.setXRange(0, 100);
        plot.setXLabel("time");
        plot.setYLabel("value");
        plot.addYTick("-PI", -Math.PI);
        plot.addYTick("-PI/2", -Math.PI / 2);
        plot.addYTick("0", 0);
        plot.addYTick("PI/2", Math.PI / 2);
        plot.addYTick("PI", Math.PI);
        plot.setMarksStyle("none");
        plot.setImpulses(true);

        boolean first = true;

        for (int i = 0; i <= 100; i++) {
            plot.addPoint(0, i, 5 * Math.cos((Math.PI * i) / 20), !first);
            plot.addPoint(1, i, 4.5 * Math.cos((Math.PI * i) / 25), !first);
            plot.addPoint(2, i, 4 * Math.cos((Math.PI * i) / 30), !first);
            plot.addPoint(3, i, 3.5 * Math.cos((Math.PI * i) / 35), !first);
            plot.addPoint(4, i, 3 * Math.cos((Math.PI * i) / 40), !first);
            plot.addPoint(5, i, 2.5 * Math.cos((Math.PI * i) / 45), !first);
            plot.addPoint(6, i, 2 * Math.cos((Math.PI * i) / 50), !first);
            plot.addPoint(7, i, 1.5 * Math.cos((Math.PI * i) / 55), !first);
            plot.addPoint(8, i, 1 * Math.cos((Math.PI * i) / 60), !first);
            plot.addPoint(9, i, 0.5 * Math.cos((Math.PI * i) / 65), !first);
            first = false;
        }
    }
View Full Code Here


     * Initialize the applet.
     */
    public void init() {
        super.init();

        Plot plot = (Plot) plot();

        plot.setTitle("Fourier Series Approximation to a Square Wave");
        plot.setXRange(0, 400);
        plot.setMarksStyle("none");
        plot.addLegend(0, "ideal");
        plot.addLegend(1, "1 sinusoid");

        for (int j = 2; j <= 10; j++) {
            plot.addLegend(j, j + " sinusoids");
        }

        boolean first = true;
        plot.addPoint(0, 0.0, 0.0, false);

        for (int i = 0; i <= 400; i++) {
            double approximation = 0.0;

            for (int j = 1; j <= 10; j++) {
                double sig = (4.0 * Math
                        .sin((i * 2.0 * Math.PI * ((2 * j) - 1)) / 400.0))
                        / (Math.PI * ((2 * j) - 1));
                approximation += sig;
                plot.addPoint(j, i, approximation, !first);
            }

            first = false;

            if (i <= 200) {
                plot.addPoint(0, i, 1.0, true);
            }

            if (i >= 200) {
                plot.addPoint(0, i, -1.0, true);
            }
        }

        plot.addPoint(0, 400.0, 0.0, true);
    }
View Full Code Here

        Scale MINUS = new Scale(this, "MINUS");

        //CTPlot ctPlot = new CTPlot(this, "CTPlot", ctPanel);
        XYPlotter xzPlot = new XYPlotter(this, "Helicopter Position");
        xzPlot.plot = new Plot();
        xzPlot.plot.setTitle("Helicopter Position");
        xzPlot.plot.setButtons(false);
        xzPlot.plot.setGrid(true);
        xzPlot.plot.setXRange(-1.0, 100.0);
        xzPlot.plot.setYRange(1.0, 12.0);
        xzPlot.plot.setSize(200, 200);
        xzPlot.plot.addLegend(0, "x, z");

        TimedPlotter vxPlot = new TimedPlotter(this, "Horizontal Speed");
        vxPlot.plot = new Plot();
        vxPlot.plot.setTitle("Horizontal Speed");
        vxPlot.plot.setButtons(false);
        vxPlot.plot.setGrid(true);
        vxPlot.plot.setXRange(0.0, 70.0);
        vxPlot.plot.setYRange(0.0, 6.0);
        vxPlot.plot.setSize(200, 200);
        vxPlot.plot.addLegend(0, "Vx");

        TimedPlotter pzPlot = new TimedPlotter(this, "Vertical Position");
        pzPlot.plot = new Plot();
        pzPlot.plot.setTitle("Vertical Position");
        pzPlot.plot.setButtons(false);
        pzPlot.plot.setGrid(true);
        pzPlot.plot.setXRange(0.0, 70.0);
        pzPlot.plot.setYRange(0.0, 12.0);
        pzPlot.plot.setSize(200, 200);
        pzPlot.plot.addLegend(0, "Pz");

        TimedPlotter thPlot = new TimedPlotter(this, "Pitch Angle");
        thPlot.plot = new Plot();
        thPlot.plot.setTitle("Pitch Angle");
        thPlot.plot.setButtons(false);
        thPlot.plot.setGrid(true);
        thPlot.plot.setXRange(0.0, 70.0);
        thPlot.plot.setYRange(-0.05, 0.05);
View Full Code Here

        Scale MINUS1 = new Scale(this, "MINUS1");
        Scale MINUS2 = new Scale(this, "MINUS2");
        Scale MINUS3 = new Scale(this, "MINUS3");

        XYPlotter myplot = new XYPlotter(this, "CTXYPlot");
        myplot.plot = new Plot();
        myplot.plot.setGrid(true);
        myplot.plot.setXRange(-25.0, 25.0);
        myplot.plot.setYRange(-25.0, 25.0);
        myplot.plot.setSize(400, 400);
        myplot.plot.addLegend(0, "(x1, x2)");
View Full Code Here

        Scale scale3 = new Scale(ctsub, "Scale3");
        Scale scale4 = new Scale(ctsub, "Scale4");
        scale4.factor.setExpression("feedbackGain");

        TimedPlotter ctPlot = new TimedPlotter(ctsub, "CTPlot");
        ctPlot.plot = new Plot();
        ctPlot.plot.setGrid(true);
        ctPlot.plot.setXRange(0.0, stopT);
        ctPlot.plot.setYRange(-1.0, 1.0);
        ctPlot.plot.setSize(500, 180);
        ctPlot.plot.addLegend(0, "Position");
        ctPlot.plot.addLegend(1, "Input");
        ctPlot.plot.addLegend(2, "Control");

        CTPeriodicSampler ctSampler = new CTPeriodicSampler(ctsub,
                "PeriodicSampler");
        ctSampler.samplePeriod.setExpression("samplePeriod");

        // CT Connections
        ctsub.connect(time.output, scale3.input);
        ctsub.connect(scale3.output, trigFunction.input);

        Relation cr0 = ctsub.connect(trigFunction.output, scale0.input, "CR0");
        ctsub.connect(scale0.output, add1.plus, "CR1");
        ctsub.connect(add1.output, intgl1.input, "CR2");

        Relation cr3 = ctsub.connect(intgl1.output, intgl2.input, "CR3");
        Relation cr4 = ctsub.connect(intgl2.output, ctPlot.input, "CR4");
        scale1.input.link(cr3);
        scale2.input.link(cr4);
        ctSampler.input.link(cr4);

        TypedIORelation cr5 = new TypedIORelation(ctsub, "CR5");
        ctSampler.output.link(cr5);
        subout.link(cr5);
        ctsub.connect(scale1.output, add1.plus, "CR6");
        ctsub.connect(scale2.output, add1.plus, "CR7");
        ctsub.connect(scale4.output, add1.plus, "CR8");

        TypedIORelation cr9 = new TypedIORelation(ctsub, "CR9");
        hold.input.link(cr9);
        subin.link(cr9);

        Relation cr10 = ctsub.connect(hold.output, scale4.input, "CR10");
        ctPlot.input.link(cr0);
        ctPlot.input.link(cr10);

        // DE System
        ptolemy.domains.de.lib.TimedDelay delay = new ptolemy.domains.de.lib.TimedDelay(
                this, "delay");
        delay.delay.setToken(new DoubleToken(0.02));

        FIR fir = new FIR(this, "fir");
        fir.taps.setExpression("{0.7, 0.3}");

        Quantizer quan = new Quantizer(this, "Quantizer");
        Average accumulator = new Average(this, "accumulator");
        Sampler sampler = new Sampler(this, "sampler");
        Clock clk = new Clock(this, "ADClock");
        clk.offsets.setExpression("{0.0}");
        clk.period.setToken(new DoubleToken(1.0));
        clk.values.setExpression("{true}");

        TimedPlotter dePlot = new TimedPlotter(this, "DEPlot");
        Plot newPlot = new Plot();
        dePlot.plot = newPlot;
        newPlot.setGrid(true);
        newPlot.setXRange(0.0, stopT);
        newPlot.setYRange(-1.0, 1.0);
        newPlot.setSize(500, 180);
        newPlot.setConnected(false);
        newPlot.setImpulses(true);
        newPlot.setMarksStyle("dots");
        newPlot.addLegend(0, "Accum");
        newPlot.addLegend(1, "Quantize");

        FIR mav = new FIR(this, "MAV");
        mav.taps.setExpression("{0.1, 0.1, 0.1, 0.1, 0.1, 0.05, 0.05, 0.05, "
                + "0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05}");
View Full Code Here

     *  After constructing this, it is necessary
     *  to call setVisible(true) to make the plot appear.
     *  @param tableau The tableau where the window is placed
     */
    public PlotTableauFrame(Tableau tableau) {
        this(tableau, new Plot());
    }
View Full Code Here

    /** Construct a plot with the specified command-line arguments.
     *  @param args The command-line arguments.
     *  @exception Exception If command line arguments have problems.
     */
    public PxgraphApplication(String[] args) throws Exception {
        this(new Plot(), args);
    }
View Full Code Here

        try {
            // Run this in the Swing Event Thread.
            Runnable doActions = new Runnable() {
                public void run() {
                    try {
                        new PxgraphApplication(new Plot(), args);
                    } catch (Exception ex) {
                        System.err.println(ex.toString());
                        ex.printStackTrace();
                    }
                }
View Full Code Here

        InputStream fileStream = this.getClass().getClassLoader()
                                             .getResourceAsStream("ptolemy/plot/servlet/"
                        + fName);

        Plot ptPlot;

        try {
            if (fileStream == null) {
                throw new ServletException("Could not find: " + fName);
            }

            ptPlot = new Plot();

            int h = 200;
            int w = 300;
            String dummy = request.getParameter("h");

            if (dummy != null) {
                h = Integer.parseInt(dummy);
            }

            dummy = request.getParameter("w");

            if (dummy != null) {
                w = Integer.parseInt(dummy);
            }

            ptPlot.setSize(w, h);

            read(ptPlot, fileStream);
        } finally {
            fileStream.close();
        }
View Full Code Here

TOP

Related Classes of ptolemy.plot.Plot$Format

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.