spline with non monotonic axis

4 ビュー (過去 30 日間)
Matt Fetterman
Matt Fetterman 2020 年 8 月 11 日
編集済み: Matt J 2020 年 8 月 11 日
Hello I am using the spline function. Here is an example from the spline documentation.
Example: Interpolate a sine-like curve over a finer mesh
x = 0:10;
y = sin(x);
xq = 0:.25:10;
yq = spline(x,y,xq);
figure
plot(x,y,'o',xq,yq)
OK in my case I have x that varies non monotonic. For example:
t = 0:100;
x= sin(0.2*t);
y = cos(0.6*t);
plot(x,y);
How to plot the spline for this case.

採用された回答

Matt J
Matt J 2020 年 8 月 11 日
編集済み: Matt J 2020 年 8 月 11 日
t = 0:100;
x= sin(0.2*t);
y = cos(0.6*t);
tq = 0:.25:100;
xy = spline(t,[x;y],tq);
plot(xy(1,:),xy(2,:));

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSplines についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by