Plotting piecewise parametric function

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
5 replies · 5K views
fishingspree2
Messages
138
Reaction score
0
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
 
Physics news on Phys.org
Depends on how fancy you want the plot to look. It would be pretty easy to do in Excel.
 
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?
 
fishingspree2 said:
How to do it with excel?

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

Code:
=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:
=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.
 
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}}]]
 
Hello, where did you get the PlotRange values? Are they really needed?