Problem using interp1 cubic
3 次查看(过去 30 天)
显示 更早的评论
I`m trying to inter a grapich but it`s wrong im using interp1 cubic
How should be

It looks wrong

Help.
Edit [21 Aug 2012, 12:45 BST - OK] Added Alex's answer here
x1=[ 1.0000 6.1000 10.1800 135.3000 136.5750....86.7650 83.2800]
y1=[ 1 23 40...... 2144 2152]
s=[1:0.1:95]
z=interp1(x1,y1,s,'cubic')
plot(s,z)
6 个评论
Oleg Komarov
2012-8-21
I think the problem is that it's not a function, i.e. you have multiple Ys for an X.
As Jose pointed out you might transpose the x with the y, interpolate and then re-transpose back.
回答(2 个)
José-Luis
2012-8-21
Try inverting your x y data
interp1(x,y,...) to interp1(y,x,...)
Cheers!
Titus Edelhofer
2012-8-21
Hi,
the plot shows that it's not a function y = f(x) and also not a function x = g(y). So you will need to move to a 2D parametrization. Take a look at the function spline that can handle the case of an arbitrary trajectory in the plane, e.g. take a look at example 4 (the cirlce).
Titus
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!