[LON-CAPA-users] {Disarmed} Re: Piecewise Linear Functions

Athanas, Angela athanas at pitt.edu
Sat Mar 21 20:57:08 EDT 2020


Hi Gene,
 I have one done for an algebra class that I am working on. The problem, which I have the code available, is published and is algebra-02-01-09.
It defines all parameters in the script part and plots the piecewise defined functions (several) in the problem part below using gnu plot.
This course is in the domain Pitt for user athanas.
Angela Athanas
________________________________
From: LON-CAPA-users <lon-capa-users-bounces at mail.lon-capa.org> on behalf of Justin Gray <jgray at math.sfu.ca>
Sent: Saturday, March 21, 2020 3:33 PM
To: Discussion list for LON-CAPA users <lon-capa-users at mail.lon-capa.org>
Subject: Re: [LON-CAPA-users] Piecewise Linear Functions

Hi Gene,

To answer your first question, here is a sample piecewise-defined function in Gnuplots:

<gnuplot width="400" solid="0" plotcolor="monochrome" gridlayer="off" bmargin="default" font="9" alttag="dynamically generated plot" bgcolor="xffffff" texfont="22" transparent="off" plottype="Cartesian" rmargin="default" gridtype="Cartesian" minor_ticscale="0.5" fontface="sans-serif" grid="on" align="middle" texwidth="93" height="300" border="on" samples="1000" fgcolor="x000000" major_ticscale="1" tmargin="default" lmargin="default" fillstyle="empty">
    <axis yzero="off" xformat="on" xmin="-10.0" yformat="on" color="x000000" ymax="10.0" ymin="-10.0" xmax="10.0" xzero="off" />
    <curve
         linestyle="lines"
         color="x000000"
         pointtype="1"
         linetype="solid"
         linewidth="1"
         name=""
         limit="closed"
         pointsize="1" >
        <function>x < 0 ? -x : x**2</function>
    </curve>
</gnuplot>

Best,
Justin

--

Justin Gray
Senior Lecturer | Department of Mathematics
Simon Fraser University | SCK 10531
8888 University Dr., Burnaby, B.C. V5A 1S6
Canada
T: 778.782.4237

Simon Fraser University is located on the Unceded Coast Salish Territories of the xʷməθkʷəy̓əm (Musqueam), Səl̓ílwətaʔ/Selilwitulh (Tsleil-Waututh), Kwikwitlem, and Skwxwú7mesh Úxwumixw (Squamish) Peoples


On Sat, Mar 21, 2020 at 11:36 AM Harding, Gene L <glhardin at purdue.edu<mailto:glhardin at purdue.edu>> wrote:

Hi,



Does anyone know how to define a piecewise linear function in LON-CAPA, and plot it with gnuplot? And, a related question: How  do you put plots next to each other?



I need to display a plot of voltage on one graph, with a plot of phase-angle-fired half-sine current right below it on a separate graph, but using the same horizontal axis values and scale. The multiplot command in gnuplot allows multiple plots next to each other, similar to MATLAB, and the ternary operator allows definition of piecewise linear functions, but I don’t know how to implement either of them from within LON-CAPA.



Best regards,



Gene L. Harding, PE

Associate Professor of ECET

Purdue University

574-520-4190

https://polytechnic.purdue.edu/south-bend/<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpolytechnic.purdue.edu%2Fsouth-bend%2F&data=02%7C01%7Cathanas%40pitt.edu%7C27fb65cb49e844b9b72308d7cdcef951%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C1%7C637204161150821773&sdata=q7VS5L%2Fc0OVj1G1DE4Ylk4Gdswcup%2BbbLie1okyqcMc%3D&reserved=0>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.lon-capa.org/pipermail/lon-capa-users/attachments/20200322/f1585a7e/attachment-0001.html>


More information about the LON-CAPA-users mailing list