當前位置: 華文世界 > 教育

平學(46):Matlab入門學習之常見命令

2024-10-12教育

分享興趣,傳播快樂,增長見聞,留下美好。

親愛的您,

這裏是LearningYard學苑!

今天小編為大家帶來文章

「平學(46):Matlab入門學習之常見命令」

歡迎您的用心存取!

Share interest, spread happiness, increase

knowledge, leave a beautiful.

Dear you,

this is LearningYard Academy.

Today, the editor brings you an article

"Ping Xue(46):Common commands for beginners to learn Matlab "

Welcome to your visit!

一、思維導圖( Mind mapping )

二、學習過程( Learning process )

1. 查詢數值內容( Query Numeric Properties )

小編首先給 a,b 隨意賦值,然後再呼叫 whos 來檢視兩個數值的相關內容,程式碼執行結果如下圖所示:

I first give a,b arbitrary value, and then call whos to see the two values of the relevant properties, the code runs as shown below:

2. 清除命令列視窗(Clear the command line window)

清除命令列視窗需要用到clc這一語句,具體效果如下圖所示:

Clearing the command line window requires the statement clc, the effect of which is shown below:

3. 清除變量(Clearing Variables)

首先透過賦值語句對變量a,b進行賦值,可見工作區會保存變量a,b的相關資訊,如下圖所示:

First of all, the variables a,b are assigned by the assignment statement, and you can see that the workspace will save the information about the variables a,b as shown in the following figure:

其次,再呼叫clear命令來清除變量,工作區中儲存的變量a,b的資訊就會被消掉,如下圖所示:

Next, the clear command is called to clear the variables, and the information stored in the workspace for variables a,b is eliminated, as shown in the following figure:

4. 清除圖形視窗( Clearing the Graphics Window)

小編首先隨機畫一個二維曲線圖,如下圖所示:

The editor first draws a random 2D graph as shown below:

然後,呼叫clf命令來檢視該語句的效果,如下圖所示:

Then, call the clf command to see the effect of the statement, as shown below:

剛剛圖形視窗中的曲線已經被消除掉了。

The curve in the graph window has just been eliminated.

5. 顯示或改變當前工作目錄(Display or change the current working directory)

小編透過呼叫cd得到了當前的工作目錄,如下圖所示:

I got the current working directory by calling cd, as shown below:

6. 顯示當前目錄或制定目錄下的檔(Displays files in the current directory or in a specified directory)

小編透過呼叫dir得到了當前目錄下的檔,如下圖所示:

I got the files in the current directory by calling dir, as shown below:

7. 條件語句(Conditional statement)

假設現在需要比較7^8和5^9的大小,可以透過以下程式碼來實作:

Suppose now you need to compare the sizes of 7^8 and 5^9, which can be done with the following code:

8. 迴圈語句(Cyclic statement)

現設定一個加法迴圈,隨著a值的增加,b在不斷的迴圈中其值也在增加,如下圖所示:

Now set up an additive loop so that as the value of a increases, so does the value of b in a continuous loop, as shown below:

今天的分享就到這裏了。

如果您對文章有獨特的想法,

歡迎給我們留言,

讓我們相約明天。

祝您今天過得開心快樂!

That's all for today's sharing.

If you have a unique idea about the article

please leave us a message

Let us meet tomorrow.

I wish you a happy day today!

參考資料:Google轉譯,百度,通義千問

本文由LearningYard學苑整理發出,如有侵權請在後台留言!

文字 | Ping

排版 | Ping

稽核 | yyz