interpolation of a sinusoidal tunnel data
Mostra commenti meno recenti
hallo eveyone, i have fluent data of a flow instive a wavy tunnel as present here. I export the data as ACII file and i want to crate matrixs so i can work on the data preaty easely. the problem is that all the scatterd interpolation mathods do not work smothly on a wavy wall, wich asagnifetly decline. i need bater mathod to work with that interpolat on the wall in between those data points and not in the normal x y deraction? any segestions ??? may data is simpal scatterd data of x,y,and u
3 Commenti
Matlab Pro
il 9 Giu 2024
please share that raw data.
+ you have 1000 of Englishe Spelling mistakes, it is hard to understand what exactly you want.
Please try to correct it and to submit a clear question
Mathieu NOE
il 10 Giu 2024
pls share your data and yur code if you have one
ran
il 10 Giu 2024
Risposte (2)
Mathieu NOE
il 11 Giu 2024
hello again
so I looked a bit some of your data , and my first question would be , why not first plot your (scattered) data with quiver or a colored quiver function, before doing some meshgrid & interpolation
here I used this Fex submission : Quiver - magnitude-dependent color in 2D and 3D - File Exchange - MATLAB Central (mathworks.com)
and you can see that there are no artifacts in the plot rendering.
then , if you really want to do meshgrid & interpolation, I noticed than 500 or 2500 points of interpolation, nor the method used had a great effect on reducing (to zero) the little "steps" close to the boundary; the only fix I could suggest here is to add a bit of 2D smoothing
here I used this Fex submission, but there are other alternatives if you have your own prefered function for this task : smooth2a - File Exchange - MATLAB Central (mathworks.com)
Quiver plot :

Filled contour plot - before smoothing :

Filled contour plot - after smoothing :

load('matlab.mat')
% Name Size Bytes Class Attributes
%
% section_P 37502x1 300016 double
% section_T 37502x1 300016 double
% section_Tw 37502x1 300016 double
% section_u 37502x1 300016 double
% section_v 37502x1 300016 double
% section_x 37502x1 300016 double
% section_y 37502x1 300016 double
figure(1) % quiver plot (with colors)
quiverC2D(section_x,section_y,section_u,section_v,1);
% Fex : https://fr.mathworks.com/matlabcentral/fileexchange/58527-quiver-magnitude-dependent-color-in-2d-and-3d?s_tid=ta_fx_results
colorbar('vert');
N = 1000; % 2500
interp_X = linspace(min(section_x), max(section_x), N);
interp_Y = linspace(min(section_y), max(section_y),round(N*0.694444444)); % "round" added
% Construct meshgrid
[interp_x, interp_y] = meshgrid(interp_X, interp_Y);
% velocity field
velo = sqrt(section_u.^2+section_v.^2).*sign(section_u);
% NB sign of section_u is used to show forward or backward oriented flow
% Interpolation using scatteredInterpolant on normalized coordinates
method = 'natural';
F_velo = scatteredInterpolant(section_x, section_y, velo, method, 'none');
Z = F_velo(interp_x, interp_y);
figure(2) % contourf plot
grid on
[hq,hqlbl] = contourf(interp_X,interp_Y,Z);
clabel(hq,hqlbl)
colorbar('vert');
% contourf plot with smoothing
ZS = smooth2a(Z,8,8);
figure(3) % contourf plot
grid on
[hq,hqlbl] = contourf(interp_X,interp_Y,ZS);
clabel(hq,hqlbl)
colorbar('vert');
4 Commenti
ran
il 11 Giu 2024
ran
il 13 Giu 2024
Mathieu NOE
il 13 Giu 2024
how did you generate this image ?
wang
il 17 Feb 2025
could you pls share your code if you have soved ,thanks.
Categorie
Scopri di più su Multibody Dynamics in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

