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
    Hi,

    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.

    :shy:
     
  2. jcsd
  3. May 21, 2010 #2

    MATLABdude

    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:
    http://www.mathworks.com/access/helpdesk/help/toolbox/curvefit/smooth.html

    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):
    http://www.dsprelated.com/groups/matlab/show/4050.php
    http://www.mathworks.com/access/helpdesk/help/techdoc/ref/spline.html
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




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