How to plot streamlines from eigenvectors & eigenvalues?

4 ビュー (過去 30 日間)
Stefan Bras
Stefan Bras 2022 年 2 月 27 日
編集済み: Abhishek Chakram 2023 年 12 月 19 日
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
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:
  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

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by