Prev: How to generate a random strongly connected graph??
Next: which block can make convolution in simulink?
From: Jennifer Young on 16 Jun 2010 04:20 Hi all, I know this is a simple question, but I am not well-versed in MATLAB and just need to solve a (complicated) equation and then plot it. The equation is: 44.0526*exp(-2*k*t)=-(log(1-(A/(B*Qm-C)))+A/(B*Qm-C)+X*(A/(B*Qm-C))^2)/((A/(B*Qm-C))^(1/3)-(A/(B*Qm-C))) where A, B, C, k and X are all constants for which I have values. I just need to solve for Qm over a given range of t, but am not sure how to approach this because I keep receiving error messages about syms or ezplot issues for various methods I have attempted. Any help would be extremely appreciated! Thanks so much. :) Jenn
From: Gang-Gyoo on 16 Jun 2010 07:11 Hi Jenn If you give me the parameter values except Qm, i'll try. Gang-Gyoo JIN "Jennifer Young" <jnnyoung(a)gmail.com> wrote in message <hva1go$h59$1(a)fred.mathworks.com>... > Hi all, > > I know this is a simple question, but I am not well-versed in MATLAB and just need to solve a (complicated) equation and then plot it. The equation is: > > 44.0526*exp(-2*k*t)=-(log(1-(A/(B*Qm-C)))+A/(B*Qm-C)+X*(A/(B*Qm-C))^2)/((A/(B*Qm-C))^(1/3)-(A/(B*Qm-C))) > > where A, B, C, k and X are all constants for which I have values. > > I just need to solve for Qm over a given range of t, but am not sure how to approach this because I keep receiving error messages about syms or ezplot issues for various methods I have attempted. Any help would be extremely appreciated! Thanks so much. :) > > Jenn
From: Gang-Gyoo on 16 Jun 2010 07:40 hi Jenn try to tune the following program with your parameters wish your success Gang-Gyoo JIN function test x0=10; x1= 100; nmax= 70; eps= 1e-5; buf= []; for t= 5:0.1:10 y= bisect(@fun, t, x0, x1, eps, nmax); buf= [buf;t y]; end plot(buf(:,1),buf(:,2)) function x= bisect(fun, t, x0, x1, eps, nmax) x2= 0; if x1 < x0 | fun(t,x0)*fun(t,x1) > 0 disp('Bound error in bisect'); x= 0; return; end for i= 1: nmax x2= (x0+x1)/2.0; if abs(x2-x1) <= eps x= x2; return; end fx0= fun(t,x0); fx2= fun(t,x2); if fx0*fx2 < 0 x1= x2; else x0= x2; end end disp('Completed unsuccessfully'); x= x2; function fval= fun(t,Qm) A= 1; B= 2; C= 0.1; X= 11;k=1; f1= 44.0526*exp(-2*k*t)+log(1-(A/(B*Qm-C))); f2= A/(B*Qm-C)+X*(A/(B*Qm-C))^2/(A/(B*Qm-C))^(1/3); f3= -A/(B*Qm-C); fval= f1+f2+f3; %44.0526*exp(-2*k*t)=-(log(1-(A/(B*Qm-C)))+A/(B*Qm-C)+ %X*(A/(B*Qm-C))^2)/((A/(B*Qm-C))^(1/3)-(A/(B*Qm-C)))
From: Torsten Hennig on 16 Jun 2010 03:41 > Hi all, > > I know this is a simple question, but I am not > well-versed in MATLAB and just need to solve a > (complicated) equation and then plot it. The equation > is: > > 44.0526*exp(-2*k*t)=-(log(1-(A/(B*Qm-C)))+A/(B*Qm-C)+X > *(A/(B*Qm-C))^2)/((A/(B*Qm-C))^(1/3)-(A/(B*Qm-C))) > > where A, B, C, k and X are all constants for which I > have values. > > I just need to solve for Qm over a given range of t, > but am not sure how to approach this because I keep > receiving error messages about syms or ezplot issues > for various methods I have attempted. Any help would > be extremely appreciated! Thanks so much. :) > > Jenn Hi Jennifer, I doubt that you can get a symbolic solution for Qm in terms of the other parameters involved. So you will have to use a numerical method. Write your equation as 44.0526*exp(-2*k*t)-(-(log(1-(A/(B*Qm-C)))+A/(B*Qm-C)+X *(A/(B*Qm-C))^2)/((A/(B*Qm-C))^(1/3)-(A/(B*Qm-C))))=0 and use fzero or fsolve to solve for the unknown Qm given a value for t. Best wishes Torsten.
From: Torsten Hennig on 16 Jun 2010 03:59 > > Hi all, > > > > I know this is a simple question, but I am not > > well-versed in MATLAB and just need to solve a > > (complicated) equation and then plot it. The > equation > > is: > > > > > 44.0526*exp(-2*k*t)=-(log(1-(A/(B*Qm-C)))+A/(B*Qm-C)+X > > > *(A/(B*Qm-C))^2)/((A/(B*Qm-C))^(1/3)-(A/(B*Qm-C))) > > > > where A, B, C, k and X are all constants for which > I > > have values. > > > > I just need to solve for Qm over a given range of > t, > > but am not sure how to approach this because I > keep > > receiving error messages about syms or ezplot > issues > > for various methods I have attempted. Any help > would > > be extremely appreciated! Thanks so much. :) > > > > Jenn > > Hi Jennifer, > > I doubt that you can get a symbolic solution for Qm > in terms of the other parameters involved. > So you will have to use a numerical method. > > Write your equation as > 44.0526*exp(-2*k*t)-(-(log(1-(A/(B*Qm-C)))+A/(B*Qm-C)+ > X > *(A/(B*Qm-C))^2)/((A/(B*Qm-C))^(1/3)-(A/(B*Qm-C))))=0 > and use fzero or fsolve to solve for the unknown Qm > given a value for t. > > Best wishes > Torsten. Or go the reverse way: Insert values for Qm and solve for t (this can be done easily in an explicit way). Afterwards, for the graphics, reverse the roles of Qm and t. Best wishes Torsten.
|
Next
|
Last
Pages: 1 2 Prev: How to generate a random strongly connected graph?? Next: which block can make convolution in simulink? |