Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Matrices with different numbers of equations

1 vue (au cours des 30 derniers jours)
Robert Pratt
Robert Pratt le 24 Mar 2020
Clôturé : MATLAB Answer Bot le 20 Août 2021
I'm supposed to construct a system of equations (Ax=b) matrix that will change depending on the number of equations given. For the forces on a bridge structure, I have equations for the first 4 and the last 4 rows of 'A'. I know how to make a matrix with these but depending on the number of nodes (N) in the structure, the number of equations will change. I'm told 'A' will be a 2N x 2N matrix and 'x' will be a 2N x 1 vector and 'b' is a 2N x 1 vector of constants. I know the equations that are dependent on the number of nodes have to utilize a loop. How would I initialize the 'A' and 'b' matrix with the zeros function manually?

Réponses (1)

John D'Errico
John D'Errico le 24 Mar 2020
You know the size of the matrix. You already know you need to use zeros to initialize it.
A = zeros(2*N,2*N);
b = zeros(2*N,1);
You might want to read the help, especially when you already know what you want to do.

Community Treasure Hunt

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

Start Hunting!

Translated by