how to multiply one number with matrix

148 ビュー (過去 30 日間)
Tanmoyee Bhattacharya
Tanmoyee Bhattacharya 2017 年 9 月 3 日
コメント済み: Image Analyst 2017 年 9 月 3 日
I have a matrix of size 3*4*4*9862
3=lat
4=lon
4=pressure
9862=number of days
I want to multiply 9.80665 with the values of this matrix if I multiply it like
k=matrix
k1=k*9.80665
or any other way

回答 (1 件)

KSSV
KSSV 2017 年 9 月 3 日
Let k be your 4 dimensional matrix. Use
k1=9.80665*k;
  2 件のコメント
Tanmoyee Bhattacharya
Tanmoyee Bhattacharya 2017 年 9 月 3 日
編集済み: Tanmoyee Bhattacharya 2017 年 9 月 3 日
If this formula is applicable for 9862 days?Or only for one day?
Image Analyst
Image Analyst 2017 年 9 月 3 日
It multiples every single value (element) in the whole matrix by that number. If you want to multiply only some days, then you'll have to index those. Like to multiply only elements with day indexes between 1000 and 2000, do this
k1 = 9.80665 * matrix(:, :, :, 1000:2000);

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by