using fsolve with arrays

1 Ansicht (letzte 30 Tage)
Tristan
Tristan am 6 Okt. 2013
Beantwortet: Walter Roberson am 6 Okt. 2013
for example, if I had:
G1=(1:1:10)*0.181881788
G2=(1:1:10)*1.281888281
and I need to find where
sum(G1*sin(G2*x))=0
I tried
x=(fsolve(@(x)sum(G1*sin(G2*x)),cc))
where cc=(1:1:5)
but it doesn't work.
thanks
  1 Kommentar
Walter Roberson
Walter Roberson am 6 Okt. 2013
What happens instead of it working ?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 6 Okt. 2013
As G1 and G2 and x are vectors, you probably want G1 .* sin(G2 .* x)
otherwise it is going to try to do matrix multiplication and likely fail.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by