How to plot streamlines from eigenvectors & eigenvalues?
古いコメントを表示
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
回答 (1 件)
Abhishek Chakram
2023 年 12 月 19 日
編集済み: Abhishek Chakram
2023 年 12 月 19 日
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:
- Get the eigenvalues using “eig” function.
- Integrate the velocity field to get the velocities.
- 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:');
disp(diag(eigenvalues));
disp('Eigenvectors:');
disp(eigenvectors);
% 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:
- eig: https://www.mathworks.com/help/matlab/ref/eig.html
- diag: https://www.mathworks.com/help/matlab/ref/diag.html
- streamline: https://www.mathworks.com/help/matlab/ref/streamline.html
- meshgrid: https://www.mathworks.com/help/matlab/ref/meshgrid.html
Best Regards,
Abhishek Chakram
カテゴリ
ヘルプ センター および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


