[LON-CAPA-users] Polar Format gnuplots

Harding, Gene L glhardin at purdue.edu
Sat May 2 11:33:52 EDT 2020


Hi everyone,

My apologies. I should have been more specific about what I am trying to do. I want to generate some notional antenna radiation pattern plots showing main lobe, back lobe, and side lobes' sizes (both peak gain and beamwidths). These plots are normally done with radial values in dB from some negative value up to zero or some positive value. The angle values on these plots are typically marked in degrees around the perimeter.

I have found some workarounds to get something approximating a polar radiation pattern plot. I used the <title> tag to mark +90 degrees, <xaxis> to mark -90, and yaxis to mark 180, but that does not give great resolution. (The plot grid only shows radii every 30 degrees.)

Likewise, I used the axis xformat and yformat parameters, in conjunction with the xtics and ytics tags, to mark radial magnitudes, but they only work for radial values from 0 to some positive number. If there is a way to do a logarithmic scale for the radial values, I cannot figure it out.

After searching through the LON-CAPA Author manual and the gnuplot manual, I think this may be as close as I can get to the equivalent of a MATLAB (theta, rho) polar plot. It appears to be a limitation of gnuplot, not LON-CAPA.

Does anyone know for sure? Maybe there is a way to do this in Geogebra, but I think I may have to compromise for now to get a problem constructed.

My code is below in case anyone wants to see what the plot looks like.

Best regards,

Gene L. Harding, PE
Associate Professor of ECET
Purdue University
574-520-4190
https://polytechnic.purdue.edu/south-bend/


POLAR ANTENNA RADIATION PATTERN PLOT
<problem>

<script type="loncapa/perl">
$amplitude=&random(0.5,3.5,0.5);
$omega=&random(1,2,0.5);
$mainlobe_gain = &random(12,22,1);  # Max antenna gain in dB
$max_plot_radius = 5*&ceil($mainlobe_gain/5);
$backlobe_gain = &random(5,8,1);  # Antenna back lobe gain in dB
$function1 = "$mainlobe_gain * abs(cos(2*t))";
$function2 = "$backlobe_gain * abs(cos(4*t))";
</script>

<gnuplot width="600" transparent="off" samples="100" grid="on" font="9" bgcolor="xffffff"
         height="600" align="right" fgcolor="x000000" border="off"
         plottype="Polar" gridtype="Polar" minor_ticscale="0" major_ticscale="0">
    <xlabel>-90°</xlabel>
    <ylabel>180°</ylabel>
    <title>+90°</title>
    <xtics increment="5.0" minorfreq="1" location="axis" mirror="off" end="$max_plot_radius" start="-$max_plot_radius" />
    <ytics increment="5.0" minorfreq="1" location="axis" mirror="off" end="$max_plot_radius" start="-$max_plot_radius" />
    <axis xmin="-$max_plot_radius" ymin="-$max_plot_radius" xmax="$max_plot_radius" ymax="$max_plot_radius"
          color="x000000" xformat="on" yformat="on" yzero="off" xzero="off" />
<!--    <axis xmin="-$max_gain" ymin="-$max_gain" xmax="$max_gain" ymax="$max_gain" color="x000000" xformat="off" yformat="off" yzero="off" xzero="off" />  -->
    <curve linestyle="linespoints" linewidth="3" name="My Plot" pointtype="0" color="x000000">
        <function> t<$pi/4 ? $function1 : t<7*$pi/8 ? 0 : t<9*$pi/8 ? $function2 : t<7*$pi/4 ? 0 : $function1 </function>
    </curve>
</gnuplot>

<font size="3">
<startouttext />
    The plot at right depicts an antenna's radiation pattern with radial units in dB gain. <br />
    What is the peak gain of the main antenna lobe? <br />
    A<sub>main lobe</sub> = <endouttext />

<numericalresponse answer="$mainlobe_gain" unit="dB" format="0f">
    <responseparam name="tol" type="tolerance" description="Numerical Tolerance" default="0.5" />
    <textline readonly="no" spellcheck="none" />
</numericalresponse>
</font>

</problem>

From: Harding, Gene L
Sent: Friday, May 1, 2020 7:39 PM
To: Discussion list for LON-CAPA users <lon-capa-users at mail.lon-capa.org>
Subject: RE: Polar Format gnuplots

Hi Angela,

Thank you for sending that. If you use angular/radial coordinates, do you know if there is a way to label the angles around the circular perimeter? I figured out how to turn off the Cartesian grid, but need to display angles from 0-360 or -180 to +180 around the circle instead of x-y coordinates.

Best regards,

Gene L. Harding, PE
Associate Professor of ECET
Purdue University
574-520-4190
https://polytechnic.purdue.edu/south-bend/

From: LON-CAPA-users <lon-capa-users-bounces at mail.lon-capa.org<mailto:lon-capa-users-bounces at mail.lon-capa.org>> On Behalf Of Athanas, Angela
Sent: Friday, May 1, 2020 7:28 PM
To: Discussion list for LON-CAPA users <lon-capa-users at mail.lon-capa.org<mailto:lon-capa-users at mail.lon-capa.org>>
Subject: [LON-CAPA-users] {Disarmed} Re: Polar Format gnuplots

I have a couple of polar area problems. Here's one:

<problem>
    <script type="loncapa/perl">
$a=&random(5,10,1); $a1=&random(1,3,1);  $b=$a-1;
for ($x = 0; $x<=2*3.141592654; $x+= 0.01) {
     push @X1, ($a+$b*sin($x))*cos($x);
     push @Y1, ($a+$b*sin($x))*sin($x);
     push @X2, ($a+$b*sin($x))*cos($x);     push @Y2, 0;
     push @X3, 0; push @Y3, ($a+$b*sin($x))*sin($x); }
$area=$a**2/2+$b**2/4;
$area1="$area*$pi";
 </script>
 <startouttext />
<br />
Determine the area of the right half of the cardioid formed by <m eval="on">\[  r = $a + $b \sin{\theta} \, \] </m> <p />

<endouttext />
<gnuplot width="400" grid="off" align="center" font="medium" height="300" border="on" alttag="dynamically generated plot" bgcolor="xffffff" fgcolor="x000000" transparent="off">
     <curve linestyle="lines" name="" color="x8B0000" pointtype="1" pointsize="1">
         <data>@X1</data>
         <data>@Y1</data>
     </curve>
    <curve linestyle="lines" name="" color="x000000" pointtype="1" pointsize="2">
         <data>@X2</data>
         <data>@Y2</data>
     </curve>
    <curve linestyle="lines" name="" color="x000000" pointtype="1" pointsize="2">
         <data>@X3</data>
         <data>@Y3</data>
     </curve>
  </gnuplot>
<p />
<startouttext />Area of cardioid right half is <endouttext />
<formularesponse answer="$area1" samples="x,pi at 3,$pi:9,$pi#4" id="11">
<responseparam name="tol" default="0.001" description="Numerical Tolerance" type="tolerance" />
        <textline size="35" readonly="no" />
    </formularesponse>
</problem>


________________________________
From: LON-CAPA-users <lon-capa-users-bounces at mail.lon-capa.org<mailto:lon-capa-users-bounces at mail.lon-capa.org>> on behalf of Harding, Gene L <glhardin at purdue.edu<mailto:glhardin at purdue.edu>>
Sent: Friday, May 1, 2020 6:03 PM
To: Discussion list for LON-CAPA users <lon-capa-users at mail.lon-capa.org<mailto:lon-capa-users at mail.lon-capa.org>>
Subject: [LON-CAPA-users] Polar Format gnuplots


Hi,



Has anyone done polar-format gnuplots in LON-CAPA? Would you be willing to share an example? This is my first foray into polar gnuplots. I am having trouble getting the angle to display around the perimeter. It's rendering x- and y-axis values instead of angle and radius values.



Best regards,



Gene L. Harding, PE

Associate Professor of ECET

Purdue University

574-520-4190

MailScanner has detected a possible fraud attempt from "nam05.safelinks.protection.outlook.com" claiming to be 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%7Cfad47791d6c841b74f7908d7ee1bafef%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637239675012270173&sdata=BxFc6JckzEaHORzCXuu3bO3AgOEJyqxsirfeqygrBg0%3D&reserved=0>


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


More information about the LON-CAPA-users mailing list