Plot for different values

2 views (last 30 days)
Hi, I'm trying to vary the value of Q but the values ​​aren't changing.
HfTOTAL = 26.8708
Hg = 30
Q = 0:50:450;
K = HfTOTAL./Q.^1.852
Hm = Hg + K.*Q.^1.852 % m
KQ = K.*Q.^1.852

Accepted Answer

Walter Roberson
Walter Roberson on 15 Aug 2021
Just for fun, let is assign Q.^1.852 to a variable, say Q18
HfTOTAL = 26.8708
Hg = 30
Q = 0:50:450;
Q18 = Q.^1.852;
K = HfTOTAL./Q18;
So K is something divided by Q18
Hm = Hg + K.*Q18 % m
And there you take K times Q18. But Q is something divided by Q18, so except for loss of precision due to round-off error, or inf or nan effects, then K*Q18 is going to be the same as the something that was then divided by Q18. So
Hm = Hg + repmat(HfTotal, 1, length(Q));
but that's just a repeated constant
KQ = K.*Q18
Again that is just the same as repmat(HfTotal, 1, length(Q)); so it is just a repeated constant.
You plot the different Q values with the repeated constant on the Y axes.
luccas santos
luccas santos on 15 Aug 2021
I found my mistake, silly thing.
I should be plotting as a function of the Q m³/h in a part I hadn't posted, and I was plotting as a function of the Q m³/s. Never that it was going to work.
Sometimes it's better to go for a walk and come back hahaha

Sign in to comment.

More Answers (0)


Community Treasure Hunt

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

Start Hunting!