フィルターのクリア

how to do 2D Extrapolation

20 ビュー (過去 30 日間)
A-Rod
A-Rod 2024 年 6 月 18 日
コメント済み: A-Rod 2024 年 6 月 19 日
hello community, I'd like to ask your support to find a solution on how to extrapolate.
my x,y,z data:
xCtT_dtPwrIncr = [3996.106 8501.15 12007.17 17002.3 34004.6 42505.75 46991.94 51006.9 59508.05 68009.2 76491.5 84992.65]; %
yCtT_dtPwrIncr = [-7.04 9.96]';
zCtT_dtPwrIncr = ...
[ 0.064502 0.105005 0.119995 0.130005 0.15 0.169995 0.205005 0.219995 0.230005 0.244995 0.26001 0.269995;
0.064502 0.105005 0.119995 0.13999 0.180005 0.219995 0.23999 0.25 0.26499 0.275 0.280005 0.3;];
for j=1:length(time)
if CtT_flgErr(j)==0 && EnvT_t(j) < 9.96 %
CtTdtIncEng(j,1) = interp2(xCtT_dtPwrIncr,yCtT_dtPwrIncr,zCtT_dtPwrIncr,PhyMod_pwrClntEntry(j),EnvT_t(j));
else
CtTdtIncEng(j,1) = interp2(xCtT_dtPwrIncr,yCtT_dtPwrIncr,zCtT_dtPwrIncr,PhyMod_pwrClntEntry(j),EnvT_t(j),'linear','extrap');
end
in this casa my data doesn't meet first condition because in my data EnvT_t > 9.96
the second condition gives me this error:
Error using interp2 (line 61)
EXTRAPVAL must be a scalar.
any recomendation on how can I extrapolate my data when EnvT_t(j) > 9.96?
I'm using these vectors/data
time EnvT_t PhyMod_pwrClntEntry CtT_flgErr
1 18.9600000000000 0 0
2 18.9600000000000 0 0
3 18.9600000000000 0 0
4 18.9600000000000 0 0
5 18.9600000000000 0 0
6 18.9600000000000 0 0
7 18.9600000000000 0 0
8 18.9600000000000 0 0
9 18.9600000000000 0 0
10 18.9600000000000 0 0
11 18.9600000000000 0 0
12 18.9600000000000 0 0
13 18.9600000000000 0 0
14 18.9600000000000 0 0
15 18.9600000000000 0 0
16 18.9600000000000 0 0
17 18.9600000000000 0 0
18 18.9600000000000 0 0
19 18.9600000000000 0 0
20 18.9600000000000 0 0
21 18.9600000000000 0 0
22 18.9600000000000 0 0
23 18.9600000000000 0 0
24 18.9600000000000 0 0
25 18.9600000000000 0 0
26 18.9600000000000 0 0
27 18.9600000000000 0 0
28 18.9600000000000 0 0
29 18.9600000000000 0 0
30 18.9600000000000 0 0
31 18.9600000000000 0 0
32 18.9600000000000 0 0
33 18.9600000000000 0 0
34 18.9600000000000 0 0
35 18.9600000000000 0 0
36 18.9600000000000 0 0
37 18.9600000000000 0 0
38 18.9600000000000 0 0
39 18.9600000000000 0 0
40 18.9600000000000 0 0
41 18.9600000000000 0 0
42 18.9600000000000 0 0
43 18.9600000000000 0 0
44 18.9600000000000 0 0
45 18.9600000000000 0 0
46 18.9600000000000 0 0
47 18.9600000000000 0 0
48 18.9600000000000 0 0
49 18.9600000000000 0 0
50 18.9600000000000 0 0
51 18.9600000000000 0 0
52 18.9600000000000 0 0
53 18.9600000000000 0 0
54 18.9600000000000 0 0
55 18.9600000000000 0 0
56 18.9600000000000 0 0
57 18.9600000000000 0 0
58 18.9600000000000 0 0
59 18.9600000000000 0 0
60 18.9600000000000 0 0
61 18.9600000000000 0 0
62 18.9600000000000 0 0
63 18.9600000000000 0 0
64 18.9600000000000 0 0
65 18.9600000000000 0 0
66 18.9600000000000 0 0
67 18.9600000000000 0 0
68 18.9600000000000 0 0
69 18.9600000000000 0 0
70 18.9600000000000 0 0
71 18.9600000000000 0 0
72 18.9600000000000 0 0
73 18.9600000000000 0 0
74 18.9600000000000 0 0
75 18.9600000000000 0 0
76 18.9600000000000 0 0
77 18.9600000000000 0 0
78 18.9600000000000 0 0
79 18.9600000000000 0 - 0
80 18.9600000000000 0 0
81 18.9600000000000 0 0
82 18.9600000000000 0 0
83 18.9600000000000 0 0
84 18.9600000000000 0 0
85 18.9600000000000 0 0
86 18.9600000000000 0 0
87 18.9600000000000 0 0
88 18.9600000000000 74587.6927815338 0
89 18.9600000000000 63579.5521233545 0
90 18.9600000000000 49612.0311854933 0
91 18.9600000000000 43033.5361688759 0
92 18.9600000000000 40790.4390142126 0
93 18.9600000000000 39301.3240964109 0
94 18.9600000000000 38924.3329779801 0
95 18.9600000000000 38905.4834220586 0
96 18.9600000000000 38283.4480766478 0
97 18.9600000000000 38094.9525174324 0
98 18.9600000000000 37849.9082904524 0
99 18.9600000000000 36643.5367114738 0
100 18.9600000000000 35964.9526982984 0
101 18.9600000000000 35983.8022542199 0
102 18.9600000000000 36304.2447048861 0
103 18.9600000000000 35983.8022542199 0
104 18.9600000000000 35870.7049186907 0
105 18.9600000000000 35474.8642443383 0
106 18.9600000000000 35908.4040305337 0
107 18.9600000000000 35380.6164647306 0
108 18.9600000000000 35964.9526982984 0
109 18.9600000000000 35870.7049186907 0
110 18.9600000000000 35663.3598035537 0
111 18.9600000000000 35512.5633561814 0
112 18.9600000000000 35041.3244581429 0
113 18.9600000000000 34871.6784548490 0
114 18.9600000000000 35644.5102476322 0
115 18.9600000000000 35248.6695732798 0
116 18.9600000000000 35927.2535864553 0
117 18.9600000000000 35644.5102476322 0
118 18.9600000000000 35456.0146884168 0
119 18.9600000000000 36209.9969252784 0
120 18.9600000000000 35964.9526982984 0
121 18.9600000000000 35889.5544746122 0
122 18.9600000000000 35946.1031423768 0
123 18.9600000000000 35474.8642443383 0
124 18.9600000000000 36266.5455930430 0
125 18.9600000000000 36473.8907081799 0
126 18.9600000000000 35701.0589153968 0
127 18.9600000000000 36379.6429285722 0
128 18.9600000000000 36228.8464811999 0
129 18.9600000000000 36700.0853792384 0
130 18.9600000000000 20508.3168426355 0
131 18.9600000000000 23448.8475663958 0
132 18.9600000000000 23995.4846881204 0
133 18.9600000000000 22129.3786518880 0
134 18.9600000000000 21281.1486354187 0
135 18.9600000000000 26822.9180763514 0
136 18.9600000000000 35173.2713495937 0
137 18.9600000000000 45634.7748860484 0
138 18.9600000000000 44767.6953136575 0
139 18.9600000000000 28632.4754448193 0
140 18.9600000000000 24768.3164809036 0
141 18.9600000000000 24334.7766947082 0
142 18.9600000000000 39866.8107740571 0
143 18.9600000000000 35286.3686851229 0
144 18.9600000000000 44541.5006425991 0
145 18.9600000000000 34155.3953298305 0
146 18.9600000000000 26559.0242934499 0
147 18.9600000000000 23411.1484545527 0
148 18.9600000000000 22789.1131091419 0
149 18.9600000000000 22883.3608887496 0
150 18.9600000000000 22807.9626650634 1

採用された回答

Ayush Modi
Ayush Modi 2024 年 6 月 19 日
編集済み: Ayush Modi 2024 年 6 月 19 日
Hi A-Rod,
The error is occuring because 'extrapVal' argument in interp2 function expects a real or complex scalar but in the provided code snippet, a char is provided.
Here is the modified code to resolve the error:
extrapVal = 0 % Change the value as per your need. 0 is only for example
CtTdtIncEng(j,1) = interp2(xCtT_dtPwrIncr,yCtT_dtPwrIncr,zCtT_dtPwrIncr,PhyMod_pwrClntEntry(j),EnvT_t(j),'linear',extrapVal);
Note - Since interpolated method is set to 'linear', this scalar value will be assigned to all queries that lie outside the domain of the sample points.
If the aim is to calculate the values outside the domain, set the method argument to 'spline' or 'makima' and remove the 'extrapVal' argument.
Here is the code to use 'spline' as the method argument:
CtTdtIncEng(j,1) = interp2(xCtT_dtPwrIncr,yCtT_dtPwrIncr,zCtT_dtPwrIncr,PhyMod_pwrClntEntry(j),EnvT_t(j),'spline');
Refer to the following MathWorks documentation for more information on
  1 件のコメント
A-Rod
A-Rod 2024 年 6 月 19 日
this helps me a lot, Thank you very much Ayush

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by