Azzera filtri
Azzera filtri

How can I obtain eigenvectors (or eigenfunctions) by inserting vector (fourier coefficients) into expansions?

5 visualizzazioni (ultimi 30 giorni)
I am trying to calculate eigenfunctions in an eigenvalue problem. I have vectors A and B, these are the coefficients of the fourier expansions. In the related book, it says that in order to find the eigenfunctions, I need to find v and w by substituting the Fourier coefficients into Fourier expansions. But as I am new to matlab my attempts were unsuccessful. I have attached the necessary screenshots from book.
A is (513x1)
B is (513x1)
x is (1x1024)
I think it does not work but I tried as follows:
N=256
for n=-N:1:N
v=sum(A.*(exp(1i*k0*n*x)));
w=sum(B.*(exp(1i*k0*n*x)));
end
How can I find (v,w) as in the attached explanations?
If you can help I would be very grateful. Thank you.

Risposta accettata

V Sairam Reddy
V Sairam Reddy il 9 Set 2022
Modificato: V Sairam Reddy il 9 Set 2022
I understand that you are trying to get the eigen functions (v,w) after substituting the Fourier coefficients into Fourier expansion and are not comfortable coding in MATLAB as a new user.
Follow the steps below to code an equation in MATLAB :
1. Be thorough with the sizes of Matrices/Vectors.
Here, "A" is a vector of size (513 by 1).
"B" is a vector of size (513 by 1).
"x" is a vector of size (1 by 1024).
x = [x1, x2, x3,.... x1024] and v(x) = [v(x1), v(x2), v(x3),.... v(x1024)] and v(x1), v(x2)... v(x1024) are all scalars as they are summation for given value x. Hence the size of "v" will be the same size as "x".
Similarly size of "w" is same as size of "x".
2. Expand equations to Identify Patterns.
According to the given equation for "v(x)", you can expand it for various values of x as shown :
3. Extract matrices from patterns.
Try to express the equations in Matrix form. "n*x" is the variable here. So, all the equations can be written in the matrix form as :
Note that exponential on a matrix is equivalent to exponential on individual element of the matrix in MATLAB.
4. Code Matrices and the Equation
"A" is already available as a Matrix. The only need is to code "Variables matrix".
% A is a 513 by 1 Matrix A = [a1 a2 a3 a4 a5]'
A = 1:513;
A = A';
L = 1024;
% X is a 1 by 1024 Matrix X = [x1 x2 x3 ... x1024]
X = 1:L;
% Range of n values
N = 256;
n = -N:1:N;
% Repeat row vector n for L times along the row
Repeated_N_Matrix = repmat(n,L,1);
% Repeat column vector X for 2N+1 times along column
Repeated_X_Matrix = repmat(X',1,2*N+1);
% Get Variables Matrix
Variables_Matrix = Repeated_N_Matrix .* Repeated_X_Matrix;
% Get "v(x)" for all x
Ko = 1;
v = exp(1i*Ko*Variables_Matrix)*A;
% All the above code can be summarised to 1 line of code
v = exp( 1i*Ko* ( repmat(n,L,1) .* repmat(X',1,2*N+1) ) ) * A;
Similarly, by using the same approach "w(x)" can be found as well.

Più risposte (0)

Categorie

Scopri di più su Linear Algebra in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by