Home>Article> How to use zeros function in matlab

How to use zeros function in matlab

藏色散人
藏色散人 Original
2020-07-06 11:42:27 118787browse

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 zeros function in matlab

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:

How to use zeros function in matlab

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:

How to use zeros function in matlab

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:

How to use zeros function in matlab

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:

How to use zeros function in matlab

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:

How to use zeros function in matlab

The sixth step finally summarizes the zeros function There are mainly the following methods of use, as shown in the figure below:

How to use zeros function in matlab

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn