Hi everyone,

Have a little problem here; hope someone might be able to help me with. I feel there is a straight forward solution to this but unfortunately I am not aware of it.

I have got a simple simulation, from which I obtain data and display it in the data display window and so on in the normal manner. The simulation is swept against say parameter â€˜Hâ€™, so all these data are plotted with respect to H. Some of these data I use to write an equation which would generate for me some thing else. So say I have three sets of data from the simulation all with respect to the swept variable, out1, out2 and ou3. Then I write two equations eqn1: A=out1+out2 and eqn2: B=out3/(out1+out2). So A and B are also with respect to the swept parameter H.

Until now that is all normal, now here is the problem; out1, out2 and out3 were all produced in 3 decimal points as a standard, i.e. in the form out1=1.234. This means the results of A and B would also be in three decimal points. A and B are two variables which are plotted in a graph against the parameter being swept, and they cross each other, i.e. there is a point at which they are equal. But due to the sweep step being used in the simulation, the point at which they cross, although it exists, but is not produced i.e. the simulation does not produce that very accurate point at which the values of A and B with all their decimal points are equal, that is because the step is not small enough. It can be produced if the simulation is re-done with a much smaller step but as expected, this would slow it down great deal. Trying to find the value of the swept parameter at which A and B are equal, I use the 'find' function in the manner C=find(A==B) but because the value at which A and B with all their decimal points equal was not produced from the simulation, the find function returns -1, i.e. it didn't find any thing. So the question is; is there a way by which I can limit the values resultant from A and B to only 1 or 2 decimal points instead of 3? This would help me do the following, if 3 decimal point of A was 2.456 and B was 2.457 the find function would fail, because it doesnâ€™t see them being equal. But I am not really interested in all that detail, it is enough for me if the find function tells me that at X point of H, A is 2.45 and B is 2.45 so they are both equal.

I hope I managed to explain what I am looking for clearly, however if you think you can help me but you didn't really understand what I am looking for, please let me know and I will try to explain it further.

Many Thanks in advance

Ali

Have a little problem here; hope someone might be able to help me with. I feel there is a straight forward solution to this but unfortunately I am not aware of it.

I have got a simple simulation, from which I obtain data and display it in the data display window and so on in the normal manner. The simulation is swept against say parameter â€˜Hâ€™, so all these data are plotted with respect to H. Some of these data I use to write an equation which would generate for me some thing else. So say I have three sets of data from the simulation all with respect to the swept variable, out1, out2 and ou3. Then I write two equations eqn1: A=out1+out2 and eqn2: B=out3/(out1+out2). So A and B are also with respect to the swept parameter H.

Until now that is all normal, now here is the problem; out1, out2 and out3 were all produced in 3 decimal points as a standard, i.e. in the form out1=1.234. This means the results of A and B would also be in three decimal points. A and B are two variables which are plotted in a graph against the parameter being swept, and they cross each other, i.e. there is a point at which they are equal. But due to the sweep step being used in the simulation, the point at which they cross, although it exists, but is not produced i.e. the simulation does not produce that very accurate point at which the values of A and B with all their decimal points are equal, that is because the step is not small enough. It can be produced if the simulation is re-done with a much smaller step but as expected, this would slow it down great deal. Trying to find the value of the swept parameter at which A and B are equal, I use the 'find' function in the manner C=find(A==B) but because the value at which A and B with all their decimal points equal was not produced from the simulation, the find function returns -1, i.e. it didn't find any thing. So the question is; is there a way by which I can limit the values resultant from A and B to only 1 or 2 decimal points instead of 3? This would help me do the following, if 3 decimal point of A was 2.456 and B was 2.457 the find function would fail, because it doesnâ€™t see them being equal. But I am not really interested in all that detail, it is enough for me if the find function tells me that at X point of H, A is 2.45 and B is 2.45 so they are both equal.

I hope I managed to explain what I am looking for clearly, however if you think you can help me but you didn't really understand what I am looking for, please let me know and I will try to explain it further.

Many Thanks in advance

Ali

I have some suggestions but havent had the opportunity to try all of them out.

1. use a different function to do what you want:

crossingpt=cross(A-B)

I believe that the cross function has teh ability to "interpolate" and figure out teh real crossing point or come up with the point closest to the zero point.

This ofcourse assumes that A-B actually does cross zero i.e. X axis. If the signal is such that A-B touches 0 but goes back in the same direction then this approach will not work.

2. Change the find equation to allow points "close" to zero.

Instead of C=find(A==B) maybe you can do

C=find(mag(A-B) < 0.001) (or some such small number.

This may end up giving you More than 1 answer depending on how many points between A and B are very close to each other.

3. The third option is to "fix" your A and B data to a specific decimal place. Unfortunately no readymade function exists in ADS to do this.

Here is a possible way to do this. Lets say I have numbers like this

A = [12.2345, 14.3456]

And I want to round it of to 2 digit decimals..

A = [12.23, 14.25]

I could use the following

newA = round(A*100)/100

I hope this works for you.

Nilesh