MATLAB Finding the Value of S in Matlab Code

  • Thread starter Thread starter flyinwelshman
  • Start date Start date
  • Tags Tags
    Matlab
AI Thread Summary
The discussion centers on a user's difficulty with iterating to find the value of S in a MATLAB code, where S is dependent on Us, which in turn is a function of S. The user provides a snippet of their code involving calculations for V, Us, Vcr, I, J, and S. A key point raised is that the current approach is problematic because it creates a circular dependency; a definite value for Us cannot be established without first knowing S. The response emphasizes the need for additional information or a different method to resolve this iterative problem effectively.
flyinwelshman
Messages
1
Reaction score
0
* Hello I'm fairly new to Matlab and I'm having trouble iterating. I'm trying to find the value S however the equation needed to evaluate it depends on S (second line). What is the best way to find S? Any help would be greatly appreciated :) My code:

Code:
V=Q/(W*R);
Us = (9.81*R*S)^0.5; 
if ((Us*d/v)>1.2) && ((Us*d/v)<70);
Vcr=w*((2.5/(log10(Us*d/v)-0.06))+0.66); 
else Vcr=w*2.05; 
end

I = 5.435-0.286*log10(w*d/v)-0.457*log10(Us/w);
J = 1.799-0.409*log10(w*d/v)-0.314*log10(Us/w); 
S=(w*Cts*10^(I/J))/(V-Vcr);
 
Last edited by a moderator:
Physics news on Phys.org
We would have required more information than what you've provided. As you require a definite value of ##Us##, and that is a function of ##S##, this method will not work.
 
Back
Top