フィルターのクリア

How can I make the dimensions agree for this function

1 回表示 (過去 30 日間)
cakey
cakey 2014 年 12 月 1 日
コメント済み: cakey 2014 年 12 月 1 日
f = @(x) x - exp(cos(transpose[1:4])*sum(x)); And x=[2.5;2;1.4;.9] is a column vector. when I subtract it says error Matrix dimensions must agree.
  2 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 12 月 1 日
After editing your question you made errors
cakey
cakey 2014 年 12 月 1 日
Should it be: f = @(x) x - exp(cos(transpose([1:4]))*sum(x))

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

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 12 月 1 日
編集済み: Azzi Abdelmalek 2014 年 12 月 1 日
f = @(x) x.' - exp(cos([1:4]*sum(x)))
  2 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 12 月 1 日
編集済み: Azzi Abdelmalek 2014 年 12 月 1 日
f = @(x) x - exp(cos([1:4]')*sum(x));
x=[2.5;2;1.4;.9]
f(x)
cakey
cakey 2014 年 12 月 1 日
Thanks, it works now!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by