Azzera filtri
Azzera filtri

How can I make the dimensions agree for this function

1 visualizzazione (ultimi 30 giorni)
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 Commenti
Azzi Abdelmalek
Azzi Abdelmalek il 1 Dic 2014
After editing your question you made errors
cakey
cakey il 1 Dic 2014
Should it be: f = @(x) x - exp(cos(transpose([1:4]))*sum(x))

Accedi per commentare.

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 1 Dic 2014
Modificato: Azzi Abdelmalek il 1 Dic 2014
f = @(x) x.' - exp(cos([1:4]*sum(x)))

Più risposte (0)

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by