How to plot streamlines from eigenvectors & eigenvalues?

4 visualizaciones (últimos 30 días)
Stefan Bras
Stefan Bras el 27 de Feb. de 2022
Editada: Abhishek Chakram el 19 de Dic. de 2023
I am having a hard time plotting streamlines from a set of eigenfunctions and eigenvalues. My problem is as following: I have a velocity deformation tensor calculated as: [0 0 0; 0 0 9; 0 9 0]. I need to make a streamline plot of the x-y, x-z, and y-z plane turning this problem into an eigenvalue problem. The eigenvalues, eigenvectors and direction (hence, velocity derivative) are calculated:
By integrating the velocity derivatives (integrating from [0,0] where u=v=w=0) I get the velocities. However I don't know how to do this and create a streamline plot of the different planes. Could somebody help me on this?
Many thanks in advance!
Stefan

Respuestas (1)

Abhishek Chakram
Abhishek Chakram el 19 de Dic. de 2023
Editada: Abhishek Chakram el 19 de Dic. de 2023
Hi Stefan Bras,
I understand that you are facing difficulty in plotting streamlines from eigenvectors and eigenvalues. Here are the steps on how to achieve this:
  1. Get the eigenvalues using “eig” function.
  2. Integrate the velocity field to get the velocities.
  3. Use the “streamline” function to plot the streamlines.
Here is a sample code for the same:
% Define the velocity deformation tensor
D = [0 0 0; 0 0 7; 0 8 0];
% Solve the eigenvalue problem
[eigenvectors, eigenvalues] = eig(D);
% Display the eigenvalues and eigenvectors
disp('Eigenvalues:');
Eigenvalues:
disp(diag(eigenvalues));
7.4833 -7.4833 0
disp('Eigenvectors:');
Eigenvectors:
disp(eigenvectors);
0 0 1.0000 0.6831 0.6831 0 0.7303 -0.7303 0
% Define the grid for integration
[x, y] = meshgrid(-1:0.1:1, -1:0.1:1); % Adjust the range as needed
% Initialize velocity components
u = zeros(size(x));
v = zeros(size(y));
% Since the deformation tensor has only yz components non-zero,
% the x-component of velocity (u) will remain zero.
% Integrate v and w using the deformation tensor
% For this simple linear case, we can directly compute v and w
v = D(2,3) * y;
w = D(3,2) * x;
% Plot the streamlines in the XY plane
figure;
streamline(x, y, u, v);
title('Streamlines in the XY plane');
xlabel('X');
ylabel('Y');
% Plot the streamlines in the XZ plane
figure;
streamline(x, y, u, w);
title('Streamlines in the XZ plane');
xlabel('X');
ylabel('Z');
% Plot the streamlines in the YZ plane
figure;
streamline(y, x, v, w);
title('Streamlines in the YZ plane');
xlabel('Y');
ylabel('Z');
You can refer to the following documentation to know more about the functions used:
Best Regards,
Abhishek Chakram

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by