Posts

Showing posts from June, 2019

Make a plot using latex

Image
In continuation to some previous post we present here how to make a plot taking advantage of latex functionality using the JLaTeXMath library.
The result of the above code is given below.

Loading a jar file

In order to to add a jar file at runtime from the SDE we just need to go from the main menu to the Load button (or using the shortcut Ctrl+L) and then find and point the appropriate jar file located somewhere in our hard drives. After that using the necessary import statements we are ready to use classes of that jar file into the climax scripts.

Baseline correction and filtering of acceleration record

Image
In this post we see some processing of a recorded acceleration signal taken from some instrument placed on an old building of Rethymno at the island of Crete (Greece). We will successively use both baseline correction through the usual polynomial detrending and filtering. The acceleration original record can be seen in the plot of Fig. 1, entitled there as "uncorrected" even if it is hardly distinguished from the "corrected" one when only detrending is used as we see in what follows.

Baseline correction takes place using a polynomial detrending approach in order to correct the vibration acceleration signals with inconsistent initial velocity and displacement. We can choose the order of the polynomial to be used which for that example has been taken as a linear one (the variable, order=1, in the code). The Apache Common Maths fitting has been used (import of the necessary class is sufficient, we do not need to load any jar file since it is by default active in SDE).







Make a plot

In order to make a simple plot in the SDE one may use the predefined object "thePlot" actually an instance of PlotFrame class.
import java.text.*; x=linspace(0.0, 6.0*PI, 10000) f={sin(it)} thePlot.addFunction(new plotfunction(x,f as DoubleFunction)) thePlot.setTexfontsize(20) thePlot.setFormatXAxis(new DecimalFormat("0.###")) thePlot.setFormatYAxis(new DecimalFormat("0.######E0")) thePlot.show()
To use a different PlotFrame, one just need to initialize it as a new variable, that is:
anotherPlot = new PlotFrame()