Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Ocean script to print intersection of two waveforms

Status
Not open for further replies.

kenambo

Full Member level 6
Joined
Feb 26, 2012
Messages
394
Helped
52
Reputation
104
Reaction score
48
Trophy points
1,308
Location
India
Activity points
3,844
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
Joined
Dec 29, 2009
Messages
187
Helped
56
Reputation
112
Reaction score
55
Trophy points
1,308
Activity points
2,170
Hi

just use fprintf function
 

dick_freebird

Advanced Member level 5
Joined
Mar 4, 2008
Messages
7,418
Helped
2,154
Reputation
4,313
Reaction score
2,028
Trophy points
1,393
Location
USA
Activity points
59,386
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
Joined
Feb 26, 2012
Messages
394
Helped
52
Reputation
104
Reaction score
48
Trophy points
1,308
Location
India
Activity points
3,844
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
Joined
Dec 29, 2009
Messages
187
Helped
56
Reputation
112
Reaction score
55
Trophy points
1,308
Activity points
2,170
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
Joined
Feb 26, 2012
Messages
394
Helped
52
Reputation
104
Reaction score
48
Trophy points
1,308
Location
India
Activity points
3,844
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
Joined
Dec 29, 2009
Messages
187
Helped
56
Reputation
112
Reaction score
55
Trophy points
1,308
Activity points
2,170
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
Joined
Feb 26, 2012
Messages
394
Helped
52
Reputation
104
Reaction score
48
Trophy points
1,308
Location
India
Activity points
3,844
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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top