Info

This question is closed. Reopen it to edit or answer.

Subscript indices must either be real positive integers or logicals.

1 view (last 30 days)
I'm inserting this equation:
D = p + K (((L./n + h) ./ C) + p + q);
but this message keeps coming up
Subscript indices must either be real positive integers or logicals.
In addition, here is how I initialize the variables (all done prior to the initialization of D )
>> p = 0.001
>>q = 0.001
>> L = 10000
>> C = 1000000
>> h=100
>> K = 10
>> n = 1:40

Answers (1)

Star Strider
Star Strider on 3 Feb 2016
My guess is that you’re missing a multiplication operator. MATLAB doesn’t do implicit multiplication.
See if this does what you want:
D = p + K * (((L./n + h) ./ C) + p + q);

Tags

Community Treasure Hunt

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

Start Hunting!