Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Plotting piecewise parametric function

  1. Apr 23, 2010 #1
    I want to plot on the same graph:

    1 < t < 2
    x(t) =1.146967180*(t-1)^3-2.178399723*(2-t)^3+38.3612214*t+106.1461765
    y(t)=.3047483217*(t-1)^3-.5750322227*(2-t)^3+10.1163822*t+444.0230985

    2 < t < 3
    x(t)=-.4672626810*(t-2)^3+1.146967180*(3-t)^3+45.2430246*t+92.3825701
    y(t)=-.1402738345*(t-2)^3+.3047483217*(3-t)^3+11.9448719*t+440.3661194

    What software allows me to plot this, a parametric piecewise curve?

    Thank you very much
     
  2. jcsd
  3. Apr 23, 2010 #2

    hotvette

    User Avatar
    Homework Helper

    Depends on how fancy you want the plot to look. It would be pretty easy to do in Excel.
     
  4. Apr 23, 2010 #3
    It isn't possible with gnuplot, maple, octave or mathematica? I can't believe such a simple thing is not possible :S

    How to do it with excel?
     
  5. Apr 23, 2010 #4

    hotvette

    User Avatar
    Homework Helper

    If your value of t is in cell A1, the following for x goes in B1:

    Code (Text):
    =IF(A1>2,-0.467262681*(A1-2)^3+1.14696718*(3-A1)^3+45.2430246*A1+92.3825701,1.14696718*(A1-1)^3-2.178399723*(2-A1)^3+38.3612214*A1+106.1461765)
    and the following in cell C1 for y:

    Code (Text):
    =IF(A1>2,-0.1402738345*(A1-2)^3+0.3047483217*(3-A1)^3+11.9448719*A1+440.3661194,0.3047483217*(A1-1)^3-0.5750322227*(2-A1)^3+10.1163822*A1+444.0230985)
    Took about 2 minutes. Plot isn't very inteststing - very linear. Log-log version has a slight curve to it. The other programs I (unfortunately) don't know at all.
     
  6. Apr 23, 2010 #5

    Hepth

    User Avatar
    Gold Member

    In Mathematica:

    Show[ParametricPlot[{1.146967180*(t - 1)^3 - 2.178399723*(2 - t)^3 +
    38.3612214*t + 106.1461765,
    0.3047483217*(t - 1)^3 - .5750322227*(2 - t)^3 + 10.1163822*t +
    444.0230985}, {t, 1, 2}, PlotRange -> {{140, 200}, {440, 500}}],
    ParametricPlot[{-0.4672626810*(t - 2)^3 + 1.146967180*(3 - t)^3 +
    45.2430246*t +
    92.3825701, -0.1402738345*(t - 2)^3 + .3047483217*(3 - t)^3 +
    11.9448719*t + 440.3661194}, {t, 2, 3},
    PlotRange -> {{140, 300}, {440, 500}}]]
     
  7. Apr 23, 2010 #6
    Hello, where did you get the PlotRange values? Are they really needed?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Plotting piecewise parametric function
Loading...