Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
how to solve a complex equation with symbolic coefficients?

Subject: how to solve a complex equation with symbolic coefficients?

From: Giuseppe

Date: 21 May, 2010 15:35:21

Message: 1 of 4

the equation is like this

solve('y*pi/b0=0.5*log((sqrt(a2+v^2)+v)/(sqrt(a2+v^2)-v))+2*gp/b0*atan(2*gp/b0*(v/sqrt(a2+v^2)))','v')

1. actually I have know the value of the coefficients in the equation, but how to transfer these value before the 'solve' command

2. It can't work out in matlab even if I syms y bo a2 gp in advance

3. if I replace the coefficients with values I could get the result of 'v', but unfortunately it is in a for loop, so I can't stop the program and write the value into the equation for each step

Thanks!

Subject: how to solve a complex equation with symbolic coefficients?

From: Roger Stafford

Date: 21 May, 2010 17:48:05

Message: 2 of 4

"Giuseppe " <motognere@gmail.com> wrote in message <ht697p$l01$1@fred.mathworks.com>...
> the equation is like this
>
> solve('y*pi/b0=0.5*log((sqrt(a2+v^2)+v)/(sqrt(a2+v^2)-v))+2*gp/b0*atan(2*gp/b0*(v/sqrt(a2+v^2)))','v')
>
> 1. actually I have know the value of the coefficients in the equation, but how to transfer these value before the 'solve' command
>
> 2. It can't work out in matlab even if I syms y bo a2 gp in advance
>
> 3. if I replace the coefficients with values I could get the result of 'v', but unfortunately it is in a for loop, so I can't stop the program and write the value into the equation for each step
>
> Thanks!

  Have you tried the 'subs' function?

Roger Stafford

Subject: how to solve a complex equation with symbolic coefficients?

From: Walter Roberson

Date: 21 May, 2010 17:56:22

Message: 3 of 4

Giuseppe wrote:
> the equation is like this
>
> solve('y*pi/b0=0.5*log((sqrt(a2+v^2)+v)/(sqrt(a2+v^2)-v))+2*gp/b0*atan(2*gp/b0*(v/sqrt(a2+v^2)))','v')
>
>
> 1. actually I have know the value of the coefficients in the equation,
> but how to transfer these value before the 'solve' command

subs()

Subject: how to solve a complex equation with symbolic coefficients?

From: Steven Lord

Date: 21 May, 2010 19:05:38

Message: 4 of 4


"Giuseppe " <motognere@gmail.com> wrote in message
news:ht697p$l01$1@fred.mathworks.com...
> the equation is like this
>
> solve('y*pi/b0=0.5*log((sqrt(a2+v^2)+v)/(sqrt(a2+v^2)-v))+2*gp/b0*atan(2*gp/b0*(v/sqrt(a2+v^2)))','v')
>
> 1. actually I have know the value of the coefficients in the equation, but
> how to transfer these value before the 'solve' command

Then don't pass your equation in as a string. Pass it in as a symbolic
expression:

% define appropriate symbolic and/or numeric variables above
S =
solve(0.5*log((sqrt(a2+v^2)+v)/(sqrt(a2+v^2)-v))+2*gp/b0*atan(2*gp/b0*(v/sqrt(a2+v^2)))-y*pi/b0)

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

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.

Contact us