Rotating data using griddata
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a tmperature flow data abouve wall with a slop. I want to smooth the data on the wall so i rotated the data using griddata(). now i want to retern to the original palne so i tray the same thing but i get matrix of NaN. do griddata() work with matrixs? any way to fix it? in my code xn yn and Tn are the original data.
load Tdata5000
theta = -atan2(0.002, 0.005 ); % in degrees
% Calculate the rotated x and y coordinates element-wise
rotated_x = xn.* cos(theta) - yn.* sin(theta);
rotated_y = xn.* sin(theta) + yn.* cos(theta);
num_points = 1000; % Adjust this number as needed
uniqe_x = linspace(min(rotated_x(:)), max(rotated_x(:)), num_points);
uniqe_y = linspace(min(rotated_y(:)), max(rotated_y(:)), num_points);
[X, Y] = meshgrid(uniqe_x, uniqe_y);
% Interpolate the temperature data onto the grid
rotated_T = griddata(rotated_x, rotated_y, Tn, X, Y);
rotated_T = smoothdata(rotated_T,2,'movmean',35);
% Reverse the rotation by using the negative angle
reverse_theta = -theta;
% Calculate the rotated x and y coordinates element-wise
original_x = X .* cos(reverse_theta) - Y .* sin(reverse_theta);
original_y = X .* sin(reverse_theta) + Y .* cos(reverse_theta);
% Interpolate the rotated and smoothed data onto the original grid
original_T = griddata(X, Y, rotated_T, original_x, original_y,'cubic');
contourf(original_x, original_x, original_T)
0 comentarios
Respuestas (1)
Ver también
Categorías
Más información sobre Interpolation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!