How do you use the "interp1" command?
1 回表示 (過去 30 日間)
古いコメントを表示
I am working on this code and for some reason i cant sure out why im getting a error. plss lmk if you
N = 128
delta_x = 2/N
x = [0:2/N:1, 1:-2/N:0]
y_int_top = interp1 (x_c, y_top, x(1, 1:65) )
y_int_bot = interp1 (x_c, y_bot, x(1, 66:130))
y_t = [y_int_top, y_int_bot]
% for i=1:N
% x(i) = x(i-1)+delta_x
%
% theta_top(i) = atan2d((y_top(i+1)-y_top(i)),((x(i+1)-x(i))));
% theta_bot(i) = atan2d((y_bot(i+1)-y_bot(i)),((x(i+1)-x(i))));
% end
4 件のコメント
回答 (1 件)
KSSV
2020 年 11 月 15 日
Try:
y_int_top = interp1 (x_c.(1), y_top.(1), x(1, 1:65) ) ;
y_int_bot = interp1 (x_c.(1), y_bot.(1), x(1, 66:130)) ;
2 件のコメント
KSSV
2020 年 11 月 16 日
Try spline instead of interp1.
N = 128
delta_x = 2/N
x = [0:2/N:1, 1:-2/N:0]
y_int_top = spline(x_c, y_top, x(1, 1:65) )
y_int_bot = spline (x_c, y_bot, x(1, 66:130))
y_t = [y_int_top, y_int_bot]
参考
カテゴリ
Help Center および File Exchange で Interpolating Gridded Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!