I need to do a technical figure showing a sinusoidal waveform plus some vertical and horizontal cursor lines and baselines. Is there any way to specify a line path in the shape of a sine function, multiplied by another function to give the effect of slowly-varying amplitude?
I would do it in Dia except there's no way AFAIK to get the sinusoid, other than importing a bitmap - but I want something scalable, to export the result as .emf for inclusion in a Word document.
I haven't yet tried generating a plot in Matlab and importing it, then tracing the curve. Has anyone successfully done this?
Thanks in advance for any helpful answers.
- dhfx
How to specify a path as a mathematical function?
Re: How to specify a path as a mathematical function?
I don't think defining mathematical graphs is possible in inkscape. I think hand tracing a bitmap might be your best bet. Although I wouldn't be surprised if MatLab could export to a vector format that could be used in Inkscape.
Re: How to specify a path as a mathematical function?
Inkscape has a function plotter extension (Effects -> Render -> Function Plotter). The way it works is a bit strange (you have to select a rectangle for it to work on), but it should allow you to make a suitable path.
The version of this extension in Inkscape 0.46 has a serious flaw (the curve is misshapen if you specify a formula for the derivative), so you may need to download the latest version of funcplot.py from SVN.
The version of this extension in Inkscape 0.46 has a serious flaw (the curve is misshapen if you specify a formula for the derivative), so you may need to download the latest version of funcplot.py from SVN.
Re: How to specify a path as a mathematical function?
Thank you, I think the function plotter is what I'm looking for. Is there a good writeup anywhere on how to use it? I tried creating a rectangle but couldn't select it in a way that the function plotter would see.
Re: How to specify a path as a mathematical function?
Should be sufficient to create a rectangle (must have fill and/or stroke visible). Then 'catch it' in a selection box and, for a test, use these values:
start x = 0
end x = 1
multiply.. =check
y value bottom = -1
y value top = 1
Samples = 20 (that is the number of nodes, higher = better)
Isotrop.. = uncheck
Use polar... = uncheck
Function = sin(x)
Calc first derivative numerically = check ( the nodes will then have handles that accord to the first derivative of the function at that point , meaning a smoother curve (an bad, bad errors if you have a complex formula and too few samples/nodes))
First derivative = Leave Blank
remove rectangle = uncheck
draw axes = uncheck
live preview = uncheck
-> then 'Apply'
start x = 0
end x = 1
multiply.. =check
y value bottom = -1
y value top = 1
Samples = 20 (that is the number of nodes, higher = better)
Isotrop.. = uncheck
Use polar... = uncheck
Function = sin(x)
Calc first derivative numerically = check ( the nodes will then have handles that accord to the first derivative of the function at that point , meaning a smoother curve (an bad, bad errors if you have a complex formula and too few samples/nodes))
First derivative = Leave Blank
remove rectangle = uncheck
draw axes = uncheck
live preview = uncheck
-> then 'Apply'
Re: How to specify a path as a mathematical function?
@loonqwal: Thanks a lot posting the parameters for plotting a simple sine wave. It was really useful to me.