フィルターのクリア

Best fit line for scatter data along y=x line

10 ビュー (過去 30 日間)
Rohit
Rohit 2024 年 9 月 7 日
コメント済み: Star Strider 2024 年 9 月 9 日
I have a scatter data point (file name PntP) and corresponding temperature values (file name uu) for different time levels. In the data file 'PntP' the PntP(:,1) is 'x' coordinate and PntP(:,2) is 'y' coordinate. In data file 'uu' each column represents the temperature values corresponding to given data points at time levels. Please give me idea how to find the temperature plot along the line y=mx pasing through coordinates (x1,y1) and (x2,y2) for a fix time stations.

採用された回答

Star Strider
Star Strider 2024 年 9 月 7 日
What sort of regression would you want for the volume in the second figure?
LD1= load('uu.mat');
uu = LD1.uu;
uu_size = size(uu)
uu_size = 1x2
4381 51
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
LD2 = load('PntP.mat');
x = LD2.PntP(:,1);
y = LD2.PntP(:,2)'
y = 1x4381
0.0155 0.0160 0.0140 0.0145 0.0150 0.0155 0.0160 0.0165 0.0170 0.0175 0.0180 0.0130 0.0135 0.0140 0.0145 0.0150 0.0155 0.0160 0.0165 0.0170 0.0175 0.0180 0.0185 0.0190 0.0125 0.0130 0.0135 0.0140 0.0145 0.0150
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
figure
scatter(x, y, '.')
grid
figure
hold on
for k = 1:size(uu,2)
scatter3(x, y, uu(:,k), '.')
end
hold off
grid on
xlabel('X')
ylabel('Y')
zlabel('UU')
view(-27,30)
The linear regressions themselves would likely not be difficult, however how would they be defined iin therms of ‘x’, ‘y’, and the columns of ‘uu’?
.
  17 件のコメント
Rohit
Rohit 2024 年 9 月 9 日
@Star Strider thank you for your efforts.
Star Strider
Star Strider 2024 年 9 月 9 日
As always, my pleasure!
This is an interesting problem!

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2024 年 9 月 7 日
m = (y2 - y1) ./ (x2 - x1);
b = y1 - x1 .* m;
LD1= load('uu.mat');
uu = LD1.uu;
LD2 = load('PntP.mat');
x = LD2.PntP(:,1);
y = LD2.PntP(:,2);
F = scatteredInterpolant(x, y, uu, 'linear', 'none');
xq = linspace(min(x), max(x));
yq = m * xq + b;
interpolated_data = F(xq, yq);
plot3(xq, yq, interpolated_data)
  1 件のコメント
Rohit
Rohit 2024 年 9 月 9 日
If we replace F = scatteredInterpolant(x, y, uu, 'linear', 'none'); by
F = scatteredInterpolant(x, y, uu(:,50), 'linear', 'none'); Than it will give the temperature on line at time 50 sec. it will work but my concern is that line should paas through the center (0.02,0.02) and both point (x1,y1) and (x2,y2) should satisfy the line. suppose I choose first cordinate like (0.03,0.022). How i will choose the second coordinate so that it satisfy the equation of line. After getting the line it may be possible some coordinates of the given PntP not lies in line so we will use interpolation. Now on this equation of line each coordinate i have to find the temperature also.

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by