|
"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <ghjlba$abl$1@fred.mathworks.com>...
> "Arik g" <elalyg@gmail.com> wrote in message <ghj6ui$9m9$1@fred.mathworks.com>...
> > .......
> > and now the strange thing: when the vector has 1, 2 or 3 values, the claculation results for those values is certain curve. when the vector has 4 or more values, the outcome changes and the same curves and results - corresponding to the values that were in the vector of size 1-3 - are now of different values, and are fluctuating in an increasung increment.
> > ......
>
> It sounds to me as though your problem is possibly that of display and not the numbers' values themselves. The displayed values for a vector will be arranged to suit the largest value present when they are displayed together. For example if you are using format short, a two-element array may show the two separate displays of 6.0000 and 6.0000e10, but together they show as:
>
> 1e10 times 0.0000 6.0000
>
> The first element really has the value of 6 but its displayed value looks like a zero in the presence of the 1e10 exponent factor.
>
> Roger Stafford
thanks for the quick reply. and sorry the the following long text, but i really need help in this:
first, a correction for what is the real problem: i notices that when the parameter's values are close to each other, the curve is OK, but when they are far (0 and 0.3, for example) then the problem starts, results change and the curve starts to fluctuate...?!?!?
however, i don't think it is a display problem - i've changed the preferences to "long e loose" for display in the command line. and also the problem is that the curve plot of the results (i do not know how to control display problems there, if you think thats the problem) shows the same problem: from being a smooth curve, when thatere are values which are close to each other [0,0.02,...,0.1]
i'll try to explain it again: i have a rather simple calculation that is done iteratively in a for-loop. the calculation includes a parameter we'll name "dispeCost". this parameter can have more than one value, naturally, because i want to see its influence on the results. so, it can be a vector of values. the calculation is somthing like:
p1aD=p1aS.*dVal1a+p1bS.*(1-dVal1b).*(1-dispeCost);
and all through the functions that are called through the process, i use ".*" - Array Multiply, as ,mentioned before. and otherwise, there shouldn't be any interaction between the differnet values of dispeCost (i've checked through the function to make sure i didn't do a stupid error).
i guess it is important to note that the values of the differnet p1a,p1aD etc are between 0 and 1, and can get really small when nearing 0 - around 10^-100 and less (i understood Matlab's limit is 10^-324, so i have a threshold to avoid "divide by zero" cases).
so when i run it for one value of dispeCost at a time, there's no aparant problem. when i run it for 2 or more, then the differnce between the extreme values kicks into action: if i run it for [0,0.1] - OK. for [0,0.05,0.1], also OK, and also OK for [0.005,0.1,0.3]. but for [0,0.1,0.3] or for [0,0.3] -NOT OK. the results for values 0 and 0.1 change this time from what they were when i ran them seperately, or as a couple [0,0.1].
therefor i guessed that the problem is the i can do calculations for values that are close to each other, OR at least vectors that do not include the value 0 in them. so ok, i can avoid non-elegantly the aparent problem. but there remains 2 important questions:
1)can i do it elegantly, and include 0 in the vector of values of the parameter "dispeCost"? what do i need to do or to change in the settings to do so?
2)does this problem i've encountered indicated a serious bug in my calculations, or is it just a problem of the extreme case of 0? in other words - can i be sure that the calculations for values other than 0 are ok?
many many thanks for the attentions
Arik
|