Thread Subject:
Using max when there is symbolic variable

Subject: Using max when there is symbolic variable

From: Maya

Date: 29 Jun, 2013 11:31:09

Message: 1 of 4

Hi,

I am trying to solve this problem:
p_i=max(0,(-1+sqrt(1-4*c_i*d_i+4*(c_i-d_i)*c_i*d_i/(x*a_i))/2*c_i*d_i) if c_i>d_i
and p_i=0 otherwise. p_i, c_i,d_i are diagonal elements of matrices P, C, D and A. I need to find x and after that to calculate p_i, but I do not know how to implement max because at first x is a symbolic variable.

I would appreciate if anyone could help me.
Maya

Subject: Using max when there is symbolic variable

From: Maya

Date: 29 Jun, 2013 11:38:10

Message: 2 of 4

"Maya" wrote in message <kqmght$e9p$1@newscl01ah.mathworks.com>...
> Hi,
>
> I am trying to solve this problem:
> p_i=max(0,(-1+sqrt(1-4*c_i*d_i+4*(c_i-d_i)*c_i*d_i/(x*a_i))/2*c_i*d_i) if c_i>d_i
> and p_i=0 otherwise. p_i, c_i,d_i are diagonal elements of matrices P, C, D and A. I need to find x and after that to calculate p_i, but I do not know how to implement max because at first x is a symbolic variable.
>
> I would appreciate if anyone could help me.
> Maya

I missed this: x>0 is chosen to satisfy the constraint Tr(A*P)>=Pt.

Subject: Using max when there is symbolic variable

From: asif khan

Date: 30 Jun, 2013 07:49:21

Message: 3 of 4

On Saturday, June 29, 2013 5:01:09 PM UTC+5:30, Maya wrote:
> Hi,
>
>
>
> I am trying to solve this problem:
>
> p_i=max(0,(-1+sqrt(1-4*c_i*d_i+4*(c_i-d_i)*c_i*d_i/(x*a_i))/2*c_i*d_i) if c_i>d_i
>
> and p_i=0 otherwise. p_i, c_i,d_i are diagonal elements of matrices P, C, D and A. I need to find x and after that to calculate p_i, but I do not know how to implement max because at first x is a symbolic variable.
>
>
>
> I would appreciate if anyone could help me.
>
> Maya

syms c_i d_i a_i x
>> expand(-1+sqrt(1-4*c_i*d_i+4*(c_i-d_i)*c_i*d_i/(x*a_i))/2*c_i*d_i)
 
ans =
 
(c_i*d_i*((4*c_i^2*d_i)/(a_i*x) - (4*c_i*d_i^2)/(a_i*x) - 4*c_i*d_i + 1)^(1/2))/2 - 1


solve(-1+sqrt(1-4*c_i*d_i+4*(c_i-d_i)*c_i*d_i/(x*a_i))/2*c_i*d_i)
 
ans =
 
(c_i*d_i*(4*c_i - 4*d_i))/(a_i*(4*c_i*d_i + 4/(c_i^2*d_i^2) - 1))

this the value of x if p_i=0

i dont understand your problem exactly....

you want to find max(0,somenumber). is it?

here somenumber is a variable.... is it?

Subject: Using max when there is symbolic variable

From: Steven_Lord

Date: 1 Jul, 2013 14:40:37

Message: 4 of 4



"Maya " <sanja_angelova@hotmail.com> wrote in message
news:kqmght$e9p$1@newscl01ah.mathworks.com...
> Hi,
>
> I am trying to solve this problem:
> p_i=max(0,(-1+sqrt(1-4*c_i*d_i+4*(c_i-d_i)*c_i*d_i/(x*a_i))/2*c_i*d_i) if
> c_i>d_i
> and p_i=0 otherwise. p_i, c_i,d_i are diagonal elements of matrices P, C,
> D and A. I need to find x and after that to calculate p_i, but I do not
> know how to implement max because at first x is a symbolic variable.

You will need to substitute numeric values into that expression before
calling MAX, since in general it is impossible to say what this function
call should return if MAX were defined for symbolic variables:

syms x y
max(x, y)

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us