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

  • Thread starter Thread starter iamazad24
  • Start date Start date
  • Tags Tags
    Line Straight line
Click For Summary
SUMMARY

This discussion focuses on connecting two straight lines with a smooth, rounded line in MATLAB. Users can achieve this by utilizing the 'smooth' function, which requires the Curve Fitting Toolbox, or by employing cubic spline interpolation for those without the toolbox. The cubic spline method allows for polynomial interpolation to create a continuous plot. Relevant resources include MATLAB's documentation on spline functions and a related forum discussion for further insights.

PREREQUISITES
  • Familiarity with MATLAB programming
  • Understanding of polynomial interpolation
  • Knowledge of x-y plotting techniques
  • Access to MATLAB Curve Fitting Toolbox (optional)
NEXT STEPS
  • Learn how to implement the MATLAB 'smooth' function
  • Explore cubic spline interpolation techniques in MATLAB
  • Review MATLAB documentation on spline functions
  • Investigate additional curve fitting methods in MATLAB
USEFUL FOR

Mathematicians, engineers, and data analysts looking to create smooth visual representations of data in MATLAB.

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:
 
Physics news on Phys.org
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
 

Similar threads

  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
Replies
6
Views
2K
  • · Replies 98 ·
4
Replies
98
Views
7K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
Replies
13
Views
4K
  • · Replies 12 ·
Replies
12
Views
2K