What is wrong with my 'if' function/

1 view (last 30 days)
Lex
Lex on 27 Mar 2014
Answered: Image Analyst on 27 Mar 2014
Hello,
In my script, I am trying to give a bucket an water inflow and an outflow if the bucket is located between two angles on a wheel (Lorenz Malkus water wheel is what i'm actually trying to program). For some reason, the script says, there isn't ever a bucket that has an inflow.
This is what I have as script now(this is just a part of the script):
if (Theta(th,j1) > ((7*pi)/16) && Theta(th,j1) < ((9*pi)/16))
h(th,j1)=h(th-1,j1) - ((A0/(pi .* Re .^ 2)) .* sqrt(2.*g.*h(th-1,j1))) .* dt + Q;
Theta is the angle in this problem, and it has an initial value (theta0)
th is the timestep, on th=1, theta = theta0, so we are trying to calculate theta on th=2 and so on.
j1 is the number of the bucket, if we have 4 buckets, j1 goes from 1 to 4.
h is the height of the water, and the part behind the - sign is the water that flows out of the bucket, Q is the inflow.
We are almost sure the fault is in the if-statement.
All help is welcome, Thanks a lot!

Accepted Answer

Image Analyst
Image Analyst on 27 Mar 2014

More Answers (0)

Community Treasure Hunt

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

Start Hunting!