導航:首頁 > 使用方法 > matlab中函數的使用方法

matlab中函數的使用方法

發布時間:2025-03-17 07:06:23

Ⅰ matlab中round函數具體用法

round函數

函數功能:四捨五入取整。

使用方法:B = round(A)

對數組A中每個元素朝最近的方向取整數部分,並返回與A同維的整數數組B,對於一個復數參量A,則分別對其實部和虛數朝最近的方向取整數部分,並返回一復數數據B。

例子:

ceil(x)返回不小於x的最小整數值(然後轉換為double型)。

floor(x)返回不大於x的最大整數值。

round(x)返回x的四捨五入整數值。

#include <stdio.h>

#include <math.h>

int main(int argc, const char *argv[])

{

float num = 1.4999;

printf("ceil(%f) is %f ", num, ceil(num));

printf("floor(%f) is %f ", num, floor(num));

printf("round(%f) is %f ", num, round(num));

return 0;

}

編譯:$cc test.c -lm

執行:$./a.out

ceil(1.499900) is 2.000000

floor(1.499900) is 1.000000

round(1.499900) is 1.000000

Matlab中round()

應用舉例:

a = [-1.9, -0.2, 3.4, 5.6, 7.0, 2.4+3.6i]

a =

Columns 1 through 4

-1.9000 -0.2000 3.4000 5.6000

Columns 5 through 6

7.0000 2.4000 + 3.6000i

round(a)

ans =

Columns 1 through 4

-2.0000 0 3.0000 6.0000

Columns 5 through 6

7.0000 2.0000 + 4.0000i

閱讀全文

與matlab中函數的使用方法相關的資料

熱點內容
錯峰分區最好的防治方法是什麼 瀏覽:662
蘋果6s切換控制怎麼設置在哪裡設置方法 瀏覽:623
車子顯示屏如何轉換輸入方法 瀏覽:614
多肉西瓜製作方法視頻 瀏覽:177
貨車反光鏡安裝方法 瀏覽:97
治療孕婦嘔吐的方法 瀏覽:707
輸液漏了怎麼處理方法 瀏覽:234
化妝展示櫃圖片和拼裝方法 瀏覽:717
皮膚出現毛孔粗大黑頭的解決方法 瀏覽:497
中學生洗內衣的步驟和方法 瀏覽:979
機械表搖表器使用方法 瀏覽:470
天子金真假煙鑒別方法技巧 瀏覽:352
關節影像學有哪些檢查方法 瀏覽:481
絕對執行力訓練方法 瀏覽:271
土壤酸度計ph試紙檢測方法 瀏覽:493
怨靈怎麼化解最好方法 瀏覽:243
貼片電容的電阻測量方法 瀏覽:84
胰腺炎之後餓了有解決方法嗎 瀏覽:277
就業問題研究的主要方法 瀏覽:638
其他有哪些swot方法 瀏覽:615