The zeros function in matlab is used to return a double class zero matrix. Its usage is: 1. Enter "B=zeros(5)" in the command line window and press the Enter key to generate a "5 *5" zero matrix; 2. Enter "B=zeros(3,4)" in the command line window and press the Enter key.
How to use the zeros function
The zeros function returns a double of m×n×p×... A function of a zero-like matrix.
The first step is to enter B=zeros(5) in the command line window and press the Enter key to see that a 5*5 zero matrix is generated, as shown in the figure below:
The second step is to enter B=zeros(3,4) in the command line window and press Enter to generate a zero matrix with 3 rows and 4 columns, as shown in the figure below:
In the third step, enter the B=zeros([3 4]) format. Press the Enter key to see that the same zero matrix with 3 rows and 4 columns as above is generated, but the format is different. Same, as shown in the figure below:
In the fourth step, enter B=zeros(3,4,5,6) in the command line window and press the Enter key to see A 3*4*5*6 all-zero matrix is generated, as shown in the figure below:
The fifth step is to create a new A variable and enter B=zeros(size(A )), press the Enter key to see that a zero matrix of the same size as the A matrix is generated, as shown in the following figure:
The sixth step finally summarizes the zeros function There are mainly the following methods of use, as shown in the figure below:
For more related knowledge, please visitPHP Chinese website!
The above is the detailed content of How to use zeros function in matlab. For more information, please follow other related articles on the PHP Chinese website!