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

I have two straight Line at a distance from one another. Need to connect them

  1. May 20, 2010 #1

    I am trying to connect two straight lines. I want the connecting line between them is round, so that altogether the total plot seems continuous. Can anyone help me how to do it in matlab.

  2. jcsd
  3. May 21, 2010 #2


    User Avatar
    Science Advisor

    Welcome to PhysicsForums!

    If you have an x-y plot and you want to smooth it out so it's not as disjointed, there're probably two ways of doing that: using the 'smooth' function, and doing a spline.

    Unfortunately, unless you have the curve fitting toolbox, you can't use the smooth function:

    Nevertheless, you can still use a cubic spline (polynominal interpolation) to determine a smoothed function which you can then plot (first link goes to another forum where somebody's asking a similar question, and the second to the actual MATLAB documentation page, along with examples):
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook