![img.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/220031/img.png)
Problem with interpolating set of data
2 views (last 30 days)
Show older comments
I feel like this is a simple problem but I can't seem to figure out where I'm going wrong.
This is what I have at the moment:
![Screen Shot 2019-05-18 at 12.05.14 am.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/219997/Screen%20Shot%202019-05-18%20at%2012.05.14%20am.png)
I'm trying to smoothly intersect with all the coloured boxes, dodging the dark green obstacles. However, my lines keep starting at x = 1, and ending 1 unit too far as well. They also don't intersect well.
Where am I going wrong? Any help is appreciated, thanks.
Answers (1)
Jyotish Kumar
on 29 May 2019
Hi,
For interpolation of first line you are using 14 points which is Xi= 0:1:13; but I can see only 13 points for 2nd plot which is Xi2=12: -1.0: 0.0;
For intersection, keep your Xi2= 13: -1.0: 0.0;
Since you are interpolating the data, so it smoothens its own and does not provide expected result. To avoid that, you can increase size of X2 and Y2. Try something like,
X2= [13 11 9 7 5 3 0];
Y2= [6 3 1 0.5 1 3 6];
I hope this helps you to get expected result.
0 Comments
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!