Ha(w) = 1./ ( ( (s./wo)+1).*( (s./wo).^2 + ((2*cos((si1)*s))./wo ) + 1 ).*( (s./wo).^2 + ( (2*cos((si1)*s))./wo ) + 1 ) ); Subscript indices must either be real positive integers or logicals.

1 view (last 30 days)
Why do I get the following error message for this equation

Accepted Answer

Star Strider
Star Strider on 12 Feb 2016
Define all the other relevant variables such as ‘s’ and ‘wo’, then try this:
Ha = @(w) 1./ ( ( (s./wo)+1).*( (s./wo).^2 + ((2*cos((si1)*s))./wo ) + 1 ).*( (s./wo).^2 + ( (2*cos((si1)*s))./wo ) + 1 ) );
w=0:1:2000;
Haw = Ha(w);
You need to define your function as an anonymous function.

More Answers (1)

Roger Stafford
Roger Stafford on 12 Feb 2016
I would guess it is caused by w in Ha(w) being neither a real positive integer nor a logical.

Community Treasure Hunt

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

Start Hunting!