using fsolve with arrays

조회 수: 1 (최근 30일)
Tristan
Tristan 2013년 10월 6일
답변: Walter Roberson 2013년 10월 6일
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
Walter Roberson
Walter Roberson 2013년 10월 6일
What happens instead of it working ?

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2013년 10월 6일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 5G Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by