Achartengine: reverse y axis, how to do? - reverse

I'm using achartengine to show graph, but I want to reverse the y axis for example from 15 up to 0. Someone can help me?

I needed just to add:
XYMultipleSeriesRenderer aRenderer = new XYMultipleSeriesRenderer();
aRenderer.setYAxisMin(15);
aRenderer.setYAxisMax(1);
aRenderer.setYLabels(15);

Related

Cut ultrasound signal between specific values using Octave

I have an ultrasound wave (graph axes: Volt vs microsecond) and need to cut the signal/wave between two specific value to further analyze this clipping. My idea is to cut the signal between 0.2 V (y-axis). The wave is sine shaped as shown in the figure with the desired cutoff points in red
In my current code, I'm cutting the signal between 1900 to 4000 ms (x-axis) (Aa = A(1900:4000);) and then I want to make the aforementioned clipping and proceed with the code.
Does anyone know how I could do this y-axis clipping?
Thanks!! :)
clear
clf
pkg load signal
for k=1:2
w=1
filename=strcat("PCB 2.1 (",sprintf("%01d",k),").mat")
load(filename)
Lthisrun=length(A);
Pico(k,1:Lthisrun)=A;
Aa = A(1900:4000);
Ah= abs(hilbert(Aa));
step=100;
hold on
i=1;
Ac=0;
for index=1:step:3601
Ac(i+1)=Ac(i)+Ah(i);
i=i+1
r(k)=trapz(Ac)
end
end
ok, you want to just look at values 'above the noise' in your data. Or, in this case, 'clip out' everything below 0.2V. the easiest way to do this is with logical indexing. You can take an array and create a sub array eliminating everything that doesn't meet a certain logical condition. See this example:
f = #(x) sin(x)./x;
x = [-100:.1:100];
y = f(x);
plot(x,y);
figure;
x_trim = x(y>0.2);
y_trim = y(y>0.2);
plot(x_trim, y_trim);
From your question it looks like you want to do the clipping after applying the horizontal windowing from 1900-4000. (you say that that is in milliseconds, but your image shows the pulse being much sooner than 1900 ms). In any case, something like
Ab = Aa(Aa > 0.2);
will create another array Ab that will only contain the portions of Aa with values above 0.2. You may need to do something similar (see the example) for the horizontal axis if your x-data is not just the element index.

Define a region with XY Coordinates

I am working with Sikuli 1.1.0 and I am a bit stuck on the following issue:
I have a XY Location of my image, named valueLocXY.
Now I would like to define a region left from it.
When looking for images and defining a region I use:
image1Loc = find("image1.png")
regionImage = image1Loc.left(100)
But when I use this for XY coordinates it won't work.
Does anyone know how to do this with XY coordinates?
Edit:
valueLoc = find(value)
valueLocXY = Location(valueLoc.getX(), valueLoc.getY())
value is the input from the definition (word) we are looking for.

Inverted Smoothstep?

I am currently trying to simulate ballistics on an object, that is otherwise not affected by physics. To be precise, I have a rocket-like projectile, that is following an parabolic arc from origin to target with a Lerp. To make it more realistic, I want it not to move at constant speed, but to slow down towards the climax and speed up on its way back down.
I have used the Mathf.Smoothstep function to do the exact opposite of what i need on other objects, i.e. easing in and out of the motion.
So my question is: How do I get an inverted Smoothstep?
I found out that what i would need is actually the inverted formula to smoothstep [ x * x*(3 - 2*x) ], but being not exactly a math genius, I have no idea how to do that. All I got from online calculators was some pretty massive new function, which I'm afraid would not be very efficient.
So maybe there is a function that comes close to an inverted smoothstep, but isn't as complex to compute.
Any help on this would be much appreciated
Thanks in advance,
Tux
Correct formula is available here:
https://www.shadertoy.com/view/MsSBRh
Solution by Inigo Quilez and TinyTexel
Flt SmoothCubeInv(Flt y)
{
if(y<=0)return 0;
if(y>=1)return 1;
return 0.5f-Sin(asinf(1-2*y)/3);
}
I had a similar problem. For me, mirroring the curve in y = x worked:
So an implementation example would be:
float Smooth(float x) {
return x + (x - (x * x * (3.0f - 2.0f * x)));
}
This function has no clamping, so that may have to be added if x can go outside the 0 to 1 interval.
Wolfram Alpha example
If you're moving transforms, it is often a good idea to user iTween or similar animation libraries instead of controlling animation yourself. They have a an easy API and you can set up easing mode too.
But if you need this as a math function, you can use something like this:
y = 0.5 + (x > 0.5 ? 1 : -1) * Mathf.Pow(Mathf.Abs(2x - 1),p)/2
Where p is the measure of steepness that you want. Here's how it looks:
You seem to want a regular parabola. See the graph of this function:
http://www.wolframalpha.com/input/?i=-%28x%2A2-1%29%5E2%2B1
Which is the graph that seems to do what you want: -(x*2-1)^2+1
It goes from y=0 to y=1 and then back again between x=0 and x=1, staying a bit at the top around x=0.5 . It's what you want, if I understood it correctly.
Other ways to write this function, according to wolfram alpha, would be -(4*(x-1)*x) and (4-4*x)*x
Hope it helps.

Want secondary Y axis to start with0.8 and end to 1

I want my secondary Y axis to start with 0.8 and end with 1 with an interval of 0.02.
(i.e. 0.8,0.82,0.84,............1).What values I have to set in Secondary Y axis properties??
hey I myself got the answer of these question.. What I have done is.. Interval---> 0.02 Interval Type--->Number Labels Format--->0.00\ I hope this will help others.

Need help in adding functionality to MIPS single cycle datapath?

I'm trying to add functionality to these datapaths so that it can read the following instruction:
ADDNEW X, Y, Z
if (Y > Z) X = Y+ Z
else X = MEM[Y+Z]
Not really sure where to start.. so any hints are appreciated. I think I need to rewrite the result of the slt somewhere to tell it which way to go.. but not sure how? Yes is for homework so not expecting answers.. just hopefully a direction. Thank you..
second http://www.utdallas.edu/~cantrell/ee4304/Pipe-data+control.jpg
The top design is a single cycle and the bottom design is a pipeline design.