Connecting two parallel lines with a smooth curve in MATLAB

1 reply · 2K views · last reply
iamazad24
Messages
10
Reaction score
0
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:
 
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