外挿値の取得について

29 Ansichten (letzte 30 Tage)
Yu
Yu am 20 Aug. 2021
Kommentiert: Yu am 20 Aug. 2021
x軸にc, y軸にDをプロットし(実線)、y軸のデータがない部分を外挿でプロットしました(点線)。
外挿のコードは以下の通りです。
その際、以下のプロット図の点線のxy数値を取得したいのですが、どうすればよいでしょうか?
N = (linspace(1450,1460,100))';
c_ext = interp1(c, D, N, 'spline', 'extrap')

Akzeptierte Antwort

Hernia Baby
Hernia Baby am 20 Aug. 2021
論理演算子を活用するのはいかがでしょうか?
以下、例を示します
x = linspace(0,10,100)';
y = sin(x) + rand(length(x),1);
xが5より小さいものだけを抜き出します
x1 = x(x<5);
y1 = y(x<5);
プロットします
plot(x,y,':',x1,y1,'--')
legend({'生データ','切り取り'});
  4 Kommentare
Hernia Baby
Hernia Baby am 20 Aug. 2021
つまり繋げたいってことですかね
clc,clear,close all;
load('samples.mat');
ここで繋げてます
x_new = [N; c];
y_new = [c_ext; D];
[x_new_sort, idx] = sort(x_new);
y_new_sort = y_new(idx);
プロットして軸反転など行ってます
plot(x_new_sort,y_new_sort)
axis ij
xlim([1450 1540])
ylim([0 500])
Yu
Yu am 20 Aug. 2021
sortとidxの組み合わせ方はとても勉強になりました。
お陰様で解決しました。
丁寧に説明くださりありがとうございました!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 言語の基礎 finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!