Ocean script to print intersection of two waveforms

Status
Not open for further replies.

kenambo

Full Member level 6
Hi,

I want to find the intersection of two waveforms and print those information into a file.

I know how to get the result from the simulation path. and got the intersect() function.

But How can i plot the intersection points into a file.

I tried ocnPrint But it includes some texts of our expression , I need to print the values only.

thanks.

sarge

Full Member level 3
Hi

just use fprintf function

dick_freebird

When I'm looking for such things I fine it much simpler
to just put a vcvs between the two signals of interest,
refer its output negative terminal to gnd! and look for
the zero crossing (using the usual functions) on the
other.

kenambo

Full Member level 6
Thanks for your help .. but I already finished the simulation now I want to access the data using Ocean.

Anyway.. what you said is good to calculate the crossing. But how does it work like this?

and @sarge fprintf produces an empty output file. Since the output of intersect() is a waveform .. I think it is better to use ocnPrint rather than fprintf.

And anyone know.. how to get data using table form as we use it through calculator function.

thanks.

sarge

Full Member level 3
ok, if it waveform then of cource ocnPrint() is that you need.

I usually use ocnPrint() in such way:

Code:
ocnPrint( ?output “~/output.txt” your_waveform ?from 0 ?to 10u ?step 50n ?precision 10 ?numberNotation ‘engineering)

this expression will print your waveform into output.txt file, waveform clipped from 0 to 10u with step 50ns, and numbers will be printed in the engineering notation.
If you need only numbers then you can easily get columns in suitable text editor (sublime text for example).

kenambo

Full Member level 6
yes sarge I also found a way but you know I need the intersection points form the intersect() function.. so I think the period is not gonna work here.

I am trying to figure out a suitable method to print exactly the intersecting points.

sarge

Full Member level 3
yes sarge I also found a way but you know I need the intersection points form the intersect() function.. so I think the period is not gonna work here.

I am trying to figure out a suitable method to print exactly the intersecting points.

Why don't you use for this purpose the cross function? You can just put in it difference of your waveforms and setup threshold at zero, that's all. This function return for you not waveform, but set of values (as I understand this exactly what you need) and you can easily print it to file with fprintf.

kenambo

Full Member level 6
hi sarge

I think the threshold voltage of zero doesn't do the trick since my needed point is above zero.

That means two waves intersecting at 4 point 0 ,500mV, 700mV, 1.2V but after the intersect function if we use zero threshold means we wont get the intersection points exactly...

thanks

Status
Not open for further replies.