Borrar filtros
Borrar filtros

How to calculate Matrix A?! (Fitting or ...)

3 visualizaciones (últimos 30 días)
Peyman
Peyman el 25 de Feb. de 2014
Comentada: Peyman el 25 de Feb. de 2014
Hello everyone,
I need to calculate Matrix A, as you can see in the photo I have attached. (my system is a lot bigger, I simplified it in several rows and columns so it can be understood easily)
I know it can be done by Fitting, however, I do not know how I can define matrix A for this purpose. In Fitting, we can define xdata=F2 and ydata=F1; but what about A?!
If also, you know any other method to calculate A, please let me know.
Thanks, Peyman
  2 comentarios
Danilo NASCIMENTO
Danilo NASCIMENTO el 25 de Feb. de 2014
let me know first, you dont wanna type in the 49 elements of matrix A?
Peyman
Peyman el 25 de Feb. de 2014
Thanks for the reply and specially for comments and suggestions.
- No, I don't want to type in all elements. They need to be calculated (and used later in another place)

Iniciar sesión para comentar.

Respuestas (1)

John D'Errico
John D'Errico el 25 de Feb. de 2014
You have a bi-diagonal matrix. One common trick is to use diag to create the main diagonal and then the sub-diagonal matrix, adding the two matrices together. Thus if a_main is a vector of main diagonal entries, and a_sub, the vector of the sub-diagonal entries...
a_main = rand(1,7);
a_sub = rand(1,6);
A = diag(a_main) + diag(a_sub,-1)A =
0.75774 0 0 0 0 0 0
0.27692 0.74313 0 0 0 0 0
0 0.046171 0.39223 0 0 0 0
0 0 0.097132 0.65548 0 0 0
0 0 0 0.82346 0.17119 0 0
0 0 0 0 0.69483 0.70605 0
0 0 0 0 0 0.3171 0.031833
Better is to learn to use sparse matrices, here the appropriate function is spdiags, which will create the complete matrix in one call. The nice thing about a sparse matrix is the storage savings as well as a speed boost for large problems.
  1 comentario
Peyman
Peyman el 25 de Feb. de 2014
- As I said, there is no limit to the matrix A; it changes with the system. And the aij also, are more than only two elements in each row, but the final matrix is still kind of a "lower triangular matrix".
- Did you just created two matrices with some numbers and then added them as matrix A? I get your point, but these aij arrays are coefficients in my equation and I want to find the coefficients.
- I can't have inverse matrix for F2(t) because it is not a square matrix! To find A, I need to use another approach. Do you have any opinion about this?

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by