Azzera filtri
Azzera filtri

Global Flag

3 visualizzazioni (ultimi 30 giorni)
Bestun
Bestun il 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.

Risposta accettata

Image Analyst
Image Analyst il 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 Commenti
Walter Roberson
Walter Roberson il 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 il 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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by