Hi @ Noob,
After going through your comments, in order to achieve a comprehensive animation of both the falling plate and the flow field in MATLAB, you can utilize the quiver function as mentioned in your comments by using arrows representing the flow and plot for the trajectory of the plate. Below is a detailed explanation and the complete code to implement this animation. First create a grid of points in the 2D space where the flow field will be evaluated. For a uniform vertical wind updraft, the velocity field. The plate's motion will be governed by the ordinary differential equations (ODEs) that describe its falling behavior through the fluid by using ode45 to solve these equations, create a loop that updates the position of the plate and the flow field at each time step, using quiver to display the flow and plot to show the plate's trajectory. To visualize the flow path, you can store the previous positions of the flow and plot them as dots.
% Parameters g = 9.81; % Acceleration due to gravity (m/s^2) h = 0.1; % Height of the plate (m) rho_f = 1.225; % Density of fluid (kg/m^3) A = 0.1; % Cross-sectional area of the plate (m^2) Cd = 1.0; % Drag coefficient v_updraft = 5; % Velocity of the updraft (m/s)
% Initial conditions y0 = [0; 0]; % Initial position [x; y] v0 = [0; -1]; % Initial velocity [vx; vy]
% Time span tspan = [0 10]; % Time from 0 to 10 seconds
% ODE function odefun = @(t, y) [y(2); -g + (0.5 * rho_f * Cd * A * (v_updraft - y(2))^2) / (rho_f * A)];
% Solve ODE [t, y] = ode45(odefun, tspan, y0);
% Create a grid for the flow field [x, y_grid] = meshgrid(-5:0.5:5, -5:0.5:5); u = zeros(size(x)); % x-component of velocity v = v_updraft * ones(size(y_grid)); % y-component of velocity
% Create figure for animation figure; hold on; axis equal; xlim([-5 5]); ylim([-5 5]); title('Plate Falling Through Fluid with Flow Field'); xlabel('X Position (m)'); ylabel('Y Position (m)');
% Initialize plot objects h_plate = plot(y(:,1), y(:,2), 'ro', 'MarkerSize', 10, 'MarkerFaceColor', 'r'); % Plate h_flow = quiver(x, y_grid, u, v, 'b'); % Flow field arrows h_path = plot(nan, nan, 'g.'); % Path tracing
% Animation loop for i = 1:length(t) % Update plate position set(h_plate, 'XData', y(i,1), 'YData', y(i,2));
% Update flow field arrows set(h_flow, 'UData', u, 'VData', v);
% Update path tracing set(h_path, 'XData', [get(h_path, 'XData'), y(i,1)], ... 'YData', [get(h_path, 'YData'), y(i,2)]);
% Pause for animation effect pause(0.1); end
hold off;
Please see attached.
Again, utilizing quiver for the flow representation and plot for the plate's trajectory, you can gain valuable insights into the dynamics of the system.
Feel free to modify the parameters and flow characteristics to explore different scenarios!
Hope this helps.