Root mean square of velocity fluctuations
14 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I am trying to calculate root mean square of velocity fluctuations in a 2D plane (x,y) coordinates with (U, V) velocity values.
Total number of points I have are 4489.
What am looking for is something like this:
Image reference: Lin, L. M., & Wu, Y. X. (2018). New interpretation of specific sign of Reynolds stress in the boundary layer on a flat plate. Theoretical and Applied Mechanics Letters, 8(6), 372-377.
I have tried the rms function:
clear all; clc; %close all;
path = pwd;
R = dir(fullfile(path,'data_2.txt'));
S = natsortfiles(R);
if iscell(S) == 0;
S = (S);
end
for k = 1:numel(S)
folder = S(k).folder;
filename = S(k).name;
F = fullfile(S(k).folder,S(k).name);
data = dlmread(F);
x = data(:,1); % x coordinate
y = data(:,2); % y coordinate
U(:,k) = data(:,4); % u velocity
V(:,k) = data(:,5); % v velocity
M_data = mean(V);
RMS_data = rms(V);
VrmsC = sqrt(mean(V.^2,2))/C; % RMS Velocity/C
figure
plot(y, V)
plot(xlim, [1 1]*M_data, 'LineWidth',1.5) plot(xlim, [1 1]*RMS_data, 'LineWidth',1.5)
plot(VrmsC, y, 'LineWidth',1.5)
plot (y, RMS_data)
end
But with no luck getting something similar to the figure above.
The data file is attached if needed.
Any thoughts how to do so?
Thank you
0 件のコメント
採用された回答
Star Strider
2022 年 12 月 28 日
The data are gridded, and actually for surfaces.
How do you want to calculate the RMS value of a surface?
data = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1245882/data_2.txt')
x = data(:,1); % x coordinate
y = data(:,2); % y coordinate
U = data(:,4); % u velocity
V = data(:,5); % v velocity
[Ux,ix] = unique(x);
Uix = unique(diff(ix))
[Uy,iy] = unique(y);
N = Uix;
xv = linspace(min(x), max(x), N);
yv = linspace(min(y), max(y), N);
[X,Y] = ndgrid(xv,yv);
Um = reshape(U,Uix,[]);
Vm = reshape(V,Uix,[]);
RMS_U = sqrt(mean(Um.^2))
RMS_V = sqrt(mean(Vm.^2))
figure
plot(RMS_U, 'DisplayName','RMS(U)')
hold on
plot(RMS_V, 'DisplayName','RMS(V)')
hold off
grid
legend('Location','best')
figure
surfc(X,Y,Um)
grid on
colormap(turbo)
xlabel('X')
ylabel('Y')
zlabel('U')
figure
surfc(X,Y,Vm)
grid on
colormap(turbo)
xlabel('X')
ylabel('Y')
zlabel('V')
This calculates the RMS values by using the square root of the square of the column mean for each surface.
Experiment to get the result you want. See the documentation on mean to take the unweighted mean across the rows instead.
.
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Distribution Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!