Hi all, could you please help me to solve this equation either numerically of symbolically.

1 view (last 30 days)
I tried to solve this equation by using following code but could not.
eq = '(y*(lo-y))*((1-v)+((1-v^2)*(rc^2-y^2)/(rc^2+y^2)))*(((1/(lo*(lo-y)))-((1/lo^2)*log((lo-y)/y)))-((1/(lo*(lo-b)))-((1/lo^2)*log((lo-b)/b))))-(kw)==0';
[y] = solve (eq,y)
Warning: Explicit solution could not be found.
> In solve at 169
In sy1 at 15
y =
[ empty sym ]
In that equation everything is known except y.
Could you please help to solve this equation .
regards Nic

Answers (2)

Ahmed A. Selman
Ahmed A. Selman on 17 Apr 2013
If all variables other than (y) are known, then let's write some notes here:
1) Try to first define the variables, namely: kw, lo, rc, v, and b. This might ease up the syms solution a lot.
2) Reduce the number of symbols used, since there are few terms that can be replaced with constants as: (v^2-1), ln(-(b-lo)/b), 1/(lo*(b-lo)).
3) use the function pretty to show your equation (eq) more clearly - check it with what you originally want to solve, and apologies for the large space it'll take, so:
pretty(eq)
/ 2 2 2 \
| (v - 1) (rc - y ) |
- kw - y (lo - y) | v + ------------------- - 1 |
| 2 2 |
\ rc + y /
/ / b - lo \ / lo - y \ \
| ln| - ------ | ln| ------ | |
| 1 1 \ b / \ y / |
| ----------- + ----------- + -------------- - ------------ |
| lo (b - lo) lo (lo - y) 2 2 |
\ lo lo /
and this looks like:
eq = F(y)*G(y)-kw = 0
a special case when kw = 0, then
F(y)*G(y) = H(y) = 0
in such case, solutions of either
F(y) = 0 or
G(y) = 0
are also, solutions of H(y).
I've honestly tried to solve it with some numeric assumptions (to achieve #1 above), and it took a long time.. so I thought to pass my ideas here since they might help you, or others willing to help.. :)
  1 Comment
Nic
Nic on 18 Apr 2013
Thanks Ahmed, I have tried to simplify the equation. I tried to run ...but still warning message with : no explicit solution. here is the simplified code. clc; clear all; close all; syms y eq ='(y/lo)-(y/lo*lo)*(lo-y)*(log(lo-y)-log(y))-y(lo-y)*k1-k4*(k2+k3*((rc^2-y^2)/(rc^2-y^2)))^-1==0' solve(eq)
when I run it I got following message
Warning: Explicit solution could not be found. > In solve at 169 In sym_1 at 6
ans =
[ empty sym]
If you have any idea please suggest me.Thanks again

Sign in to comment.


Walter Roberson
Walter Roberson on 17 Apr 2013
You are asking to solve the equation for the variable "x", but there is no "x" in the equation.
On the other hand, the warning message you show apparently has an assignment to "y", and that assignment does not occur in your code.
  3 Comments
Nic
Nic on 19 Apr 2013
Edited: Walter Roberson on 19 Apr 2013
Thanks walter, sorry for confusion....I need to solve it with respect to y.
I tried to solve it numerically, but its not happening...
my complete code is as follows
function f = myfun_y(y) %function
global locr rb vc rc wb bcr % variables defined
f1 = ((y-rb)/(locr*(locr-y)*(locr-rb)))+((1/locr^2)*log*((y*(locr-rb))/(rb*(locr-y))));
f2 = (y*(locr-y))*((1.+vc)+(1.-vc^2)*(rc^2-y^2)/(rc^2+y^2));
f3 = wb*bcr;
f = f1*f2-f3;
%%%%%%%%%%%%%%%
global bcr vc locr rc rb wb
% define given parameters
bcr = 0.713;
vc = 0.18;
locr=0.092;
rc = 0.056;
rb = 0.008;
wb = 1.19;
% define upper limit and lower limit of wc
% gl = 0.008; % lower limit
% gu = 0.056; % upper limit
% go = [gl,gu]; % define interval between which value of x will be found
% compute the root of wc f(wc)=0.0 using fzer0 function
[y,fval,exitflag,output] = fzero('myfun_y',[0.008,0.056])
when I run this code, i got following error message
Error using fzero (line 233)
FZERO cannot continue because user supplied function_handle ==> myfun_y
failed with the error below.
Not enough input arguments.
Error in compute_y (line 22)
[y,fval,exitflag,output] = fzero('myfun_y',[0.008,0.056])
Could you please suggest me...what is going ...many thanks..the value of y should be between 0.008 and 0.056

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!