Inner product calculation using discretised Chebyshev points and a energy matrix

조회 수: 5 (최근 30일)
I am trying to generate a matrix A which looks at the first K eigenvalues/eigenvectors in a eigenvalue problem.
The solution vector is q = [u,v,w,rho,T]. (Think 'fluid dynamics'.)
A is defined as the inner product of the k^th eigenvector with the the l^th eigenvector.
Matrix M is an energy 'weight' matrix specific to my problem. My problem is discretised using Chebyshev gridpoints, therefore i have included an integral 'weight' to each of the values in M as per the Chebyshev integral weightings.
Here is a brief look at the maths that I'm trying to implement.
where,
Here's my code (using arbitrary rho, Tt, w and qtildeu) - is this implementation of the integral in for the A matrix elements defined in the photo above correct in my code?
Mach = 0.01;
gamma = 1.4;
K = 12; % number of eigenvectors that are included
N = 100; % number of gridpoints
Z = zeros(N);
rho = ones(N,1); % arbitrary rho
Tt = rho.*1.234; % arbitrary Tt
w = ones(N,1); % chebyshev weights set as one for sake of MATLAB online question
Q1 = diag(rho.*w);
Q2 = diag(rho.*w);
Q3 = diag(rho.*w);
Q4 = diag(Tt./(rho.*gamma.*Mach.^2).*w);
Q5 = diag(rho./(gamma.*(gamma-1).*Tt.*Mach^2).*w);
Q = [Q1 Z Z Z Z;
Z Q2 Z Z Z;
Z Z Q3 Z Z;
Z Z Z Q4 Z;
Z Z Z Z Q5]; % MATRIX M from question
qtildeu = 0.5.*ones(5*N,K); % random eigenvectors
% obtaining weight matrix A
for k = 1:K
for l = k:K
A(k,l) = qtildeu(:,k)'*Q*qtildeu(:,l);
A(l,k) = A(k,l); % symmetric matrix
end
end

답변 (1개)

Gautam
Gautam 2024년 5월 20일
Hello, Isabelle
I understand that you want to generate the matrix “A”, which is obtained by
The attached piece of code implements the matrix product “” but doesn’t compute the integral. It is also unclear as to what the variable “y” is with respect to which the integral is being performed
If it is known how the eigen vectors “” and “”, and the weight matrix “M” are represented in terms of “y”, one way to compute the integral would be to define the vectors and matrix ”, “and “M” as symbolic arrays and matrix in “y”, compute the product as
f(y) =
and integrate with respect to “y” under the specified limits using the “int” function to obtain the elements of the matrix A
A(k,l) = int(f, y, 0, inf);
You can refer to the following MathWorks documentation for more information on the “int” function

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by