Package systole.domain.signals

Examples of systole.domain.signals.Segment


    @Override
    public Object deepCopy(Object o) throws HibernateException {
        if (o == null) {
            return null;
        }
        Segment segment = (Segment) o;
        Segment clone = new Segment(segment.toDoubleArray());
        return clone;
    }
View Full Code Here


        int nPoints = segment.size();
        int h = 1//h interval taken
        int step = 1;
        BigDecimal diff = BigDecimal.ZERO;

        Segment derivated = new Segment();

        //f'(x) = f(x+h) - f(x-h)/h ; En este caso, h = 1
        for (int j = 0; j < nPoints - 2; j++) {

            diff = (segment.elementAt(j + h).subtract(segment.elementAt(j))).divide(new BigDecimal(2 * h),MathUtils.CONTEXT);
            derivated.add(diff);
        }

        diff = derivated.elementAt(1).subtract(derivated.firstElement());
        derivated.insertElementAt(derivated.firstElement().subtract(diff), 0);
        return derivated;

    }
View Full Code Here

        int nPoints = segment.size();
        BigDecimal h = BigDecimal.ONE;  //h interval taken
        BigDecimal diff = BigDecimal.ZERO;
        int step = 2;
        BigDecimal two = new BigDecimal(2);
        Segment derivated = new Segment();


        for (int j = 0; j < (nPoints - 3); j++) {

            //f''(x) = (f(x+2) - 2f(x+1) + f(x))/h^2 ; En este caso, h = 1
            diff = (segment.elementAt(j + 2).subtract(two.multiply(segment.elementAt(j + 1))).add(segment.elementAt(j).divide(h.pow(step),MathUtils.CONTEXT)));

            derivated.add(diff);
        }
        diff = derivated.elementAt(1).subtract(derivated.firstElement());
        derivated.insertElementAt(derivated.firstElement().subtract(diff), 0);
        return derivated;

    }
View Full Code Here

        BigDecimal h = BigDecimal.ONE;  //h interval taken
        int step = 3;
        BigDecimal three = new BigDecimal(3);
        BigDecimal diff = BigDecimal.ZERO;

        Segment derivated = new Segment();

        //f'''(x) = (f(x+3) - 3f(x+2) + 3f(x+1) -f(x))/h^3 ; En este caso, h = 1
        for (int j = 0; j < (nPoints - 3); j++) {

            diff = ((segment.elementAt(j + 3)).subtract(three.multiply(segment.elementAt(j + 2))).
                    add(three.multiply(segment.elementAt(j + 1))).
                    subtract(segment.elementAt(j))).divide(h.pow(step),MathUtils.CONTEXT);

            derivated.add(diff);
        }

        diff = derivated.elementAt(1).subtract(derivated.firstElement());
        derivated.insertElementAt(derivated.firstElement().subtract(diff), 0);
        derivated.insertElementAt(derivated.firstElement().subtract(diff), 0);
        return derivated;
    }
View Full Code Here

        int step = 4;
        BigDecimal four = new BigDecimal(4);
        BigDecimal six = new BigDecimal(6);
        BigDecimal diff = BigDecimal.ZERO;

        Segment derivated = new Segment();

        //f'''(x) = (f(x+4) - 4f(x+3) + 6f(x+2) -4f(x+1) + f(x))/h^3 ; En este caso, h = 1
        for (int j = 0; j < (nPoints - 4); j++) {

            diff = ((segment.elementAt(j + 4)).subtract(
                    (four.multiply(segment.elementAt(j + 3)))).add(
                    (six.multiply(segment.elementAt(j + 2)))).subtract(
                    (four.multiply(segment.elementAt(j + 1)))).add(
                    (segment.elementAt(j)))).divide(h.pow(step),MathUtils.CONTEXT);

            derivated.add(diff);
        }

         diff = derivated.elementAt(1).subtract(derivated.firstElement());
        derivated.insertElementAt(derivated.firstElement().subtract(diff), 0);
        derivated.insertElementAt(derivated.firstElement().subtract(diff), 0);
        derivated.insertElementAt(derivated.firstElement().subtract(diff), 0);
        return derivated;
    }
View Full Code Here

        FinalSignal signal = new FinalSignal();

        signal.setFinalSegment(segment);

        Segment first = this.getFirstDerivative(segment);
        first.multiplyVectorBy(new BigDecimal(8));
        first.addValuteToVector(new BigDecimal(50.0));
        signal.setFirstDerivatite(first);

        Segment second = this.getSecondDerivative(first);
        second.multiplyVectorBy(new BigDecimal(10));
        second.addValuteToVector(new BigDecimal(50.0));
        signal.setSecondDerivative(second);

        Segment third = this.getThirdDerivative(second);
        third.multiplyVectorBy(new BigDecimal(2));
        third.addValuteToVector(new BigDecimal(50.0));
        signal.setThirdDerivative(third);


        Segment fourth = this.getThirdDerivative(third);
        fourth.multiplyVectorBy(new BigDecimal(5));
        fourth.addValuteToVector(new BigDecimal(50.0));
        signal.setFourthDerivative(fourth);

        return signal;
    }
View Full Code Here

        int nPoints = segment.size();
        BigDecimal h = BigDecimal.ONE;  //h interval taken
        BigDecimal diff = BigDecimal.ZERO;

        Segment derivated = new Segment(nPoints);

        for (int j = 1; j < (nPoints - 1); j++) {
            //f'(x) = f(x+h) - f(x-h)/h ; En este caso, h = 1
            diff = (segment.elementAt(j + 1).subtract(segment.elementAt(j - 1))).divide((h.multiply(new BigDecimal(2))),MathUtils.CONTEXT);
            // diff = (segment.elementAt(j).doubleValue() - segment.elementAt(j-1).doubleValue());
            derivated.add(diff);
        }
        //continuo el mismo punto para no dejarlo en cero y que las restas sean enormes
        derivated.insertElementAt(derivated.elementAt(1), 0);
        //derivated.insertElementAt(derivated.elementAt(nPoints - 2), nPoints - 1);

        return derivated;
    }
View Full Code Here

        try {
            if ((this.parentControl.getSelectionModel().getSelectedSegments() != null)) {

                SignalProcessor processor = new SignalProcessor();
                //Returns a signal composed by the selected segments
                Segment segment = processor.process(this.parentControl.getSelectionModel().getSelectedSegments());

                if ((segment != null) && (!segment.isEmpty())) {

                    if (!this.parentControl.isWaitingForClose()) {
                        this.doCharts(segment);
                    }

                    segment = segment.normalize();

                    finalSignal = processor.calcDerivatives(segment, new SimpleDerivative());

                    if (!this.parentControl.isWaitingForClose()) {
                        this.doDerivatives(segment);
View Full Code Here

        if ((this.file != null) && (!this.file.getAbsolutePath().equals(this.preview.getjTxtFile().getText()))) {

            this.rawSignal = null;
            this.preview.getjTxtFile().setText("");

            Segment segment = null;
            try {
                segment = this.reader.readFile(file);
                if (segment != null) {
                    this.rawSignal = new RawSignal();
                    this.getRawSignal().setSegment(segment);
View Full Code Here

    private void doPloit() {
        if (this.getRawSignal() != null) {
            this.preview.getjPnlCenter().removeAll();
            this.preview.getjPnlCenter().setLayout(new BorderLayout());
            Segment segment = (this.getRawSignal().isInverted() ? this.getRawSignal().getSegment().invert() : this.getRawSignal().getSegment());
            XYChart ploter = new XYChart("Tren de pulsos", "Muestras", "Amplitud");
            ploter.addSeries("pulsos", segment.toDoubleArray(), 1);
            ploter.setShowLegend(false);
            ploter.setShowTitle(false);
            this.chart = ploter.plot();
            this.preview.getjPnlCenter().add(this.chart, BorderLayout.CENTER);
        } else {
View Full Code Here

TOP

Related Classes of systole.domain.signals.Segment

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.