フィルターのクリア

How can I create it?

1 回表示 (過去 30 日間)
Taner Cokyasar
Taner Cokyasar 2016 年 2 月 12 日
コメント済み: Star Strider 2016 年 2 月 12 日
How can I create a 5x5 matrix with the following criterion: aij = 2cos(0.4(i-j)π)

採用された回答

Star Strider
Star Strider 2016 年 2 月 12 日
A bit more efficiently, using meshgrid:
[i,j] = meshgrid(1:5);
a = 2*cos(0.4*(i-j)*pi);
  2 件のコメント
Taner Cokyasar
Taner Cokyasar 2016 年 2 月 12 日
Thank you very much. It works out great!
Star Strider
Star Strider 2016 年 2 月 12 日
My pleasure!
The meshgrid function can make a number of matrix calculations easier.

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

その他の回答 (1 件)

jgg
jgg 2016 年 2 月 12 日
Try this
A = 2*cos(0.4.*pi.*(repmat([1:5]',1,5) - repmat([1:5],5,1)));
  1 件のコメント
Taner Cokyasar
Taner Cokyasar 2016 年 2 月 12 日
Thank you jgg.

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

カテゴリ

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