Electronics > PCB/EDA/CAD

How do I slice a vector in a Qucs simulation using an equation?

(1/1)

**niconiconi**:

Any Qucs expert here? I'm trying to calculate some circuit parameters in Qucs using user-defined equations from the simulation results. The simulation is a 1001-point transient simulation, the output node is labelled as "out". After the simulation completes, the output voltage versus time is accessible as a vector out.Vt, and one can access the n-th element using the syntax out.Vt[n] in a user-defined equation. For example, out.Vt[500] is the 500th data point.

Now I need to slice this vector, for example, to obtain the first 500 data points. But I don't know the correct syntax for this task. I've already read the documentation, including Short Description of Mathematical Functions, and Measurement Expressions Reference Manual. Unfortunately, none of these documents contain any helpful example.

I've already tried out.Vt[1:500] and out.Vt[1,500]. But I got either an "Invalid" or "Wrong Dependency" error. What is the correct syntax for slicing a vector in Qucs?

I've already posted this question on Stack Exchange and the Qucs mailing list, but so far didn't get any response. Unfortunately Qucs is a dying breed these days due to lack of development and maintenance, despite the fact that it's still a fairly powerful free and open source circuit simulator.

**mag_therm**:

The following in an equation block will give vectors for plotting within a span, the values outside the span are set to 0

My_span1=time<1.33e-7?time:0

My_span2=time>1.33e-7?time:0

Out1=My_span1?Out.Vt:0

Out2=My_span2?Out.Vt:0

Note that the case else :0 must be included.

If you need to create new truncated vectors, there may be a similar way, but I have not tried that.

maybe functions eye() and linspace()

If you can work out how to do that within qucs, I would like to see your method.

Navigation

[0] Message Index

Go to full version