外挿値の取得について
34 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
x軸にc, y軸にDをプロットし(実線)、y軸のデータがない部分を外挿でプロットしました(点線)。
外挿のコードは以下の通りです。
その際、以下のプロット図の点線のxy数値を取得したいのですが、どうすればよいでしょうか?
N = (linspace(1450,1460,100))';
c_ext = interp1(c, D, N, 'spline', 'extrap')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/716619/image.png)
0 commentaires
Réponse acceptée
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
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])
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur ライン プロット dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!