From: Walter Roberson on
FRUITS wrote:
> On Jun 1, 5:33 pm, Walter Roberson <rober...(a)hushmail.com> wrote:

>> What shape is D? is it length(parameter1) by length(parameter2) ?

> Thanks for replying. Here is my basic code

> D=b1-b2;

You have not indicated the shape of b1 or b2, so I cannot tell what
shape D is ?

> pcolor(param1s,param2s,double(Ldiff>0))

Please be more specific about how you want to color the areas where D is
non-negative.


> Ldiff(i,j)=length(find(D<0));

Ldiff(i,j) = any(D<0);

would be more efficient.


> pcolor(param1s,param2s,double(Ldiff>0))

Your pcolor has param1s in the first argument, the one for x, but your
double for loop indexes param1s in the outer loop, j, which you use as
the second index of Ldiff, which is normally the position used for y
rather than x. If the lengths of param1s and param2s are not the same,
then this will cause your pcolor() call to fail.

As you referenced x as being the variable you wanted to vary the color
over, we need you to be clearer about whether that is the first or
second index of Ldiff.
From: FRUITS on
On Jun 1, 6:17 pm, Walter Roberson <rober...(a)hushmail.com> wrote:
> FRUITS wrote:
> > On Jun 1, 5:33 pm, Walter Roberson <rober...(a)hushmail.com> wrote:
> >> What shape is D? is it length(parameter1) by length(parameter2) ?
> > Thanks for replying.  Here is my basic code
> >         D=b1-b2;
>
> You have not indicated the shape of b1 or b2, so I cannot tell what
> shape D is ?
>

sorry, b1 and b2 are the numerical solutions of my pde and when
plotted against x at steady state they look like a quadratic function.

>  > pcolor(param1s,param2s,double(Ldiff>0))
>
> Please be more specific about how you want to color the areas where D is
> non-negative.

I want to loop through "my other program" using param1(i) and
param2(j) and see if b1-b2 is becoming negative anywhere in my spatial
domain as the parameters are changing. param(i) is varying for
example from 0 to 100 in 100 steps ... etc

>
>  > Ldiff(i,j)=length(find(D<0));
>
> Ldiff(i,j) = any(D<0);
>
> would be more efficient.

>
>  > pcolor(param1s,param2s,double(Ldiff>0))
>
> Your pcolor has param1s in the first argument, the one for x, but your
> double for loop indexes param1s in the outer loop, j, which you use as
> the second index of Ldiff, which is normally the position used for y
> rather than x.

thanks for pointing that out, I will double check it.

If the lengths of param1s and param2s are not the same,
> then this will cause your pcolor() call to fail.
>

The lengths are the same. The pcolor is working, but it is not
exactly how I want it to present the results.

> As you referenced x as being the variable you wanted to vary the color
> over, we need you to be clearer about whether that is the first or
> second index of Ldiff.

maybe this is not so clear. The pcolor I want is param1 vs param2 vs
where D is negative.

Specifically, I want to include in the code not only if D is negative
or not, but where in the spatial domain is it negative. E.g, If it is
negative where x<(somevalue) then colour it blue. If it is negative
where x>(somevalue) then colour it red....etc

Note: I am not plotting x in the pcolor...x is only involved in my
"other program" that solves the set of pdes.


I hope it is a bit clearer now, thanks.


From: Walter Roberson on
FRUITS wrote:

>> Please be more specific about how you want to color the areas where D is
>> non-negative.

> I want to loop through "my other program" using param1(i) and
> param2(j) and see if b1-b2 is becoming negative anywhere in my spatial
> domain as the parameters are changing. param(i) is varying for
> example from 0 to 100 in 100 steps ... etc

You indicated that when 0 < x < 25, you want negative values to be green, and
when 25 < x < 50, you want negative values to be blue. Now suppose I find a
point for which 0 < x < 25, but the point has no associated negative values:
what color should the point be colored? What if the point with no negative
values where in 25 < x < 50, then what color should it be colored? What if the
point has associated negative values but for the point, x is 25 _exactly_ and
thus does not fall into either the green region (which needs less than 25) nor
the blue region (which needs more than 25) ?


>> As you referenced x as being the variable you wanted to vary the color
>> over, we need you to be clearer about whether that is the first or
>> second index of Ldiff.
>
> maybe this is not so clear. The pcolor I want is param1 vs param2 vs
> where D is negative.
>
> Specifically, I want to include in the code not only if D is negative
> or not, but where in the spatial domain is it negative. E.g, If it is
> negative where x<(somevalue) then colour it blue. If it is negative
> where x>(somevalue) then colour it red....etc
>
> Note: I am not plotting x in the pcolor...x is only involved in my
> "other program" that solves the set of pdes.

Do I understand correctly that x is a variable involved in the section you
marked as "run my program with these parameters" ? That after that section of
code, we can count on x having a value? If so, then is x relatively easily
predictable based on the parameters (which might allow us to color sections of
the array at one time), or should x be treated as "sufficiently magic" in the
parameters that we should just do the color selection point by point?
From: FRUITS on
On Jun 1, 8:40 pm, Walter Roberson <rober...(a)hushmail.com> wrote:
> FRUITS wrote:
> >> Please be more specific about how you want to color the areas where D is
> >> non-negative.
> > I want to loop through "my other program" using param1(i) and
> > param2(j) and see if b1-b2 is becoming negative anywhere in my spatial
> > domain as the parameters are changing.  param(i) is varying for
> > example from 0 to 100 in 100 steps ... etc
>
> You indicated that when 0 < x < 25, you want negative values to be green, and
> when 25 < x < 50, you want negative values to be blue. Now suppose I find a
> point for which 0 < x < 25, but the point has no associated negative values:
> what color should the point be colored? What if the point with no negative
> values where in 25 < x < 50, then what color should it be colored? What if the
> point has associated negative values but for the point, x is 25 _exactly_ and
> thus does not fall into either the green region (which needs less than 25) nor
> the blue region (which needs more than 25) ?

This is exactly what I want to do. I want to give any negative values
that happen to occur in the region 0 <= x <= 25 a specific color
(say,green), (as long as the negative points are in the region, it
does not matter how many negative points I have - i.e the length),
and the ones in the region 25 <= x <= 50 another color and 0 <= x <=
50 (ie. the whole x domain) another color.

If I dont have any negative values in any region I also want to give
it another color...so, in total I need to assign 4 different colors to
4 different cases.

I think it is fairly straightforward to implement, but I have had no
hopes with it so far. Maybe someone can enlighten me, Thanks!




>
> >> As you referenced x as being the variable you wanted to vary the color
> >> over, we need you to be clearer about whether that is the first or
> >> second index of Ldiff.
>
> > maybe this is not so clear. The pcolor I want is param1 vs param2 vs
> > where D is negative.
>
> > Specifically, I want to include in the code not only if D is negative
> > or not, but where in the spatial domain is it negative.  E.g, If it is
> > negative where x<(somevalue) then colour it blue.  If it is negative
> > where x>(somevalue) then colour it red....etc
>
> > Note: I am not plotting x in the pcolor...x is only involved in my
> > "other program" that solves the set of pdes.
>
> Do I understand correctly that x is a variable involved in the section you
> marked as "run my program with these parameters" ? That after that section of
> code, we can count on x having a value? If so, then is x relatively easily
> predictable based on the parameters (which might allow us to color sections of
> the array at one time), or should x be treated as "sufficiently magic" in the
> parameters that we should just do the color selection point by point?


yes, x is just a spatial independent variable of the pde.
From: Walter Roberson on
FRUITS wrote:

> This is exactly what I want to do. I want to give any negative values
> that happen to occur in the region 0 <= x <= 25 a specific color
> (say,green), (as long as the negative points are in the region, it
> does not matter how many negative points I have - i.e the length),
> and the ones in the region 25 <= x <= 50 another color and 0 <= x <=
> 50 (ie. the whole x domain) another color.
>
> If I dont have any negative values in any region I also want to give
> it another color...so, in total I need to assign 4 different colors to
> 4 different cases.

We are getting closer, but I do not understand the bit about the whole x
domain. You appear to be saying that when 0 <= x < 25, that you want to
color the point both the first color _and_ the third color, since 0 <= x
< 25 is also part of the range 0 <= x <= 50; likewise, 25 < x <= 50
should be colored both the second and third color, and 25 exactly, which
falls under all three conditions, should be all three colors simultaneous.