Statistics extrapolation on the data
21 ビュー (過去 30 日間)
古いコメントを表示
I have data in the below format and am not sure what is the best way to extrapolate the data i need with relative good accuracy.
x = [10, 30, 40, 50, 60]..... This is various temperature.
y = [10, 10, 10, 10, 5]........This is the voltage.
z = [1:100,1:100,1:100,1:100,1:100]....The values of the sensor from time 1 to 100 seconds, for x(i) and y(i).
I don't have the data for x = 60 and y = 5. I would like to exterpolate this to remove the dependency on the y value and later will use x, z in combination with other parameters as a gridedinterpolant.
I can just neglect the 60 temp and 5 voltage data i have and completely extrapolate with interp2 and spline method, but somehow it is not giving proper output.
What are the ways i can have the existing data of 60 temp and 5, some effect on the extrapolated data.
I am also open to use the existing data and directly find value for the x, y....But i think interp3 will require meshgrid and values known for each brakepoint.
0 件のコメント
回答 (1 件)
Karan Singh
2025 年 2 月 18 日 6:22
Just a suggstion how about using "scatteredInterpolant". You can read more about it here https://in.mathworks.com/help/matlab/ref/scatteredinterpolant.html
You can first, “vectorize” your data. For example, if for each temperature (x) and corresponding voltage (y) you have 100 time points (z), you can reshape your data into a list of points. Then, build a scattered interpolant using the available (x,y,z) points.
When you query at a new (x,y) (for example, x = 60 and y = 5) the interpolant will perform an interpolation (or even extrapolation if needed) based on your chosen method (like ‘linear’). This way the (x = 60, y = 5) point although “missing” in your original grid is indirectly accounted for by how it relates to its neighbors.
% Example data
x = [10, 30, 40, 50, 60];
y = [10, 10, 10, 10, 5];
z = [linspace(1,100,100);
linspace(1,100,100);
linspace(1,100,100);
linspace(1,100,100);
linspace(1,100,100)];
% Suppose you wish to build an interpolant for a particular time index, say t = 50.
% Alternatively, if you have many time points, you might want to process each time step.
% Here, we choose one value from each row (e.g., column 50).
zVal = z(:,50); % sensor reading at time 50 for each (x,y)
% Now, create a scattered interpolant using the available (x,y) points.
F = scatteredInterpolant(x(:), y(:), zVal(:), 'linear');
% 'linear' extrapolation are chosen here (you can change these options)
% Query the interpolant at the desired point (e.g., x=60, y=5)
query_x = 60;
query_y = 5;
z_query = F(query_x, query_y)
% z_query will be an extrapolated estimate at (60,5)
disp(z_query);
Karan
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!