フィルターのクリア

A smoother surfplot, maybe with pchip interpolation

4 ビュー (過去 30 日間)
Mohammed Saifuddin Ustad
Mohammed Saifuddin Ustad 2023 年 5 月 12 日
コメント済み: Mathieu NOE 2023 年 6 月 28 日
hello everyone,
I have made a surfplot using linear interpolation with x,y,z data from a csv. However i want to make the plot smoother. I have tried cubic interpolation and it does make it better. However i have heard that pchip would make it even smoother, though i have not been able to use that. So looking for a way to utilise pchip or any other interpolation method to make my surfplot smoother. and yes i am aware that increasing N would make it better, but looking for other ways.
T1 = readtable('solarcol3.csv');
VarNames = T1.Properties.VariableNames;
x = T1{:,1};
y = T1{:,2};
z = T1{:,3};
[Ux,iax,ixx] = unique(x);
[Uy,iay,ixy] = unique(y);
N = 25;
xv = linspace(min(x), max(x), N);
yv = linspace(min(y), max(y), N);
[Xm,Ym] = ndgrid(xv, yv);
Zm = griddata(x, y, z, Xm, Ym, 'cubic'); % specify cubic interpolation
figure
surfc(Xm, Ym, Zm)
colorbar
grid on
xlabel('Wind Velocity (m/s)')
ylabel('Heat Flux (W/m2)')
zlabel('Mass Flow Rate (kg/s)')

回答 (1 件)

Mathieu NOE
Mathieu NOE 2023 年 5 月 15 日
hello
I used this excellent FEX submission to get this result :
T1 = readtable('solarcol3.csv');
VarNames = T1.Properties.VariableNames;
x = T1{:,1};
y = T1{:,2};
z = T1{:,3};
[Ux,iax,ixx] = unique(x);
[Uy,iay,ixy] = unique(y);
N = 25;
xv = linspace(min(x), max(x), N);
yv = linspace(min(y), max(y), N);
[Xm,Ym] = ndgrid(xv, yv);
Zm = griddata(x, y, z, Xm, Ym, 'cubic'); % specify cubic interpolation
Zm = smoothn(Zm,1000); % Fex : https://fr.mathworks.com/matlabcentral/fileexchange/25634-smoothn?s_tid=ta_fx_results
figure
surfc(Xm, Ym, Zm)
colorbar
grid on
xlabel('Wind Velocity (m/s)')
ylabel('Heat Flux (W/m2)')
zlabel('Mass Flow Rate (kg/s)')
  11 件のコメント
Mathieu NOE
Mathieu NOE 2023 年 6 月 28 日
Hello
Problem solved ?
would you mind accepting my answer ? thanks !

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

カテゴリ

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

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by