外挿値の取得について

20 vues (au cours des 30 derniers jours)
Yu
Yu le 20 Août 2021
Commenté : Yu le 20 Août 2021
x軸にc, y軸にDをプロットし(実線)、y軸のデータがない部分を外挿でプロットしました(点線)。
外挿のコードは以下の通りです。
その際、以下のプロット図の点線のxy数値を取得したいのですが、どうすればよいでしょうか?
N = (linspace(1450,1460,100))';
c_ext = interp1(c, D, N, 'spline', 'extrap')

Réponse acceptée

Hernia Baby
Hernia Baby le 20 Août 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 commentaires
Hernia Baby
Hernia Baby le 20 Août 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 le 20 Août 2021
sortとidxの組み合わせ方はとても勉強になりました。
お陰様で解決しました。
丁寧に説明くださりありがとうございました!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 言語の基礎 dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!