Clear Filters
Clear Filters

Global Flag

3 views (last 30 days)
Bestun
Bestun on 17 Apr 2012
Dear All
I am using flag in my code and when I run the code with these set of parameters
HenXoma(1, 9.81, 0.017, 1, 8.8, 15.2, 1, 1, 0, 0, 2, 4, 0, 36.9, 15.2)
I got a solution of 30.2 (this number is just for explaining)
Then When I am changing the fourth input parameter which is =(1) to (0)(lets call this parameter Yw), I got the same solution (30.2). It should be different solution.
After debugging I found that Matlab took the previous value of Yw as (1) not the new value (0). Also I made clear in the command window to ensure that the work space is cleared.but I got the same answer I appreciate any useful suggestion and thanks for your help.

Accepted Answer

Image Analyst
Image Analyst on 17 Apr 2012
I'd say that Yw is not used, or has no effect, in the internal code of HenXoma (which we can't see because you didn't post it.) Why don't you post it.
If Yw is a global variable (I assume that's what "Glabal" means to you), you don't need to pass it via the argument list, you just declare it global inside the function.
  3 Comments
Walter Roberson
Walter Roberson on 18 Apr 2012
Yw has no effect on your code if the global variable "flag" is 2. At present we have no way of knowing what its value is.
Bestun
Bestun on 18 Apr 2012
Dear Walter
I am taking flag = 1 , so there is effect of Yw on the dlor function . Yes if flag = 2 , the code is running a test of the equations which are not depending on Yw value.
However, changing Yw from 0 to 1 does not change the solution (in my equations Yw is dependent variable) at all and it must be change
Regards

Sign in to comment.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!