Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Matrices with different numbers of equations

1 Ansicht (letzte 30 Tage)
Robert Pratt
Robert Pratt am 24 Mär. 2020
Geschlossen: MATLAB Answer Bot am 20 Aug. 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?

Antworten (1)

John D'Errico
John D'Errico am 24 Mär. 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