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:
Resolve equation in Matlab

Subject: Resolve equation in Matlab

From: Darshan

Date: 21 Nov, 2011 20:45:09

Message: 1 of 4

hi

I am using the following command to solve the equation in MATLAB

CR = 0.012
t = solve('1-exp((t^0.22)*(1/CR)*(exp(-CR*(t^0.78))-1))=0.999725776893977','t')

But it gives me the error when I run,

solve('1-exp((x^0.22)*(1/CR)*(exp(-CR*(x^0.78))-1))=0.999725776893977','t')
Warning: Explicit solution could not be found.
> In solve at 140
 
ans =
 
[ empty sym ]

Pls let me know your suggestion.
Thanks.
Dare.

Subject: Resolve equation in Matlab

From: Roger Stafford

Date: 22 Nov, 2011 03:03:09

Message: 2 of 4

"Darshan" wrote in message <jaed8l$168$1@newscl01ah.mathworks.com>...
> CR = 0.012
> t = solve('1-exp((t^0.22)*(1/CR)*(exp(-CR*(t^0.78))-1))=0.999725776893977','t')
> Warning: Explicit solution could not be found.
 - - - - - - - - -
  Apparently your equation is beyond the ability of 'solve' to find a solution, as can happen very easily. You therefore need to do your problem numerically. Matlab's 'fzero' would be a good function to use. It requires that you enter an initial estimate for a root. As a preliminary step you can make a plot of your function to assist in making a reasonable estimate. To avoid complex numbers you will need to restrict t to positive numbers.

Roger Stafford

Subject: Resolve equation in Matlab

From: Christopher Creutzig

Date: 22 Nov, 2011 12:33:19

Message: 3 of 4

On 21.11.11 21:45, Darshan wrote:
> hi
>
> I am using the following command to solve the equation in MATLAB
>
> CR = 0.012
> t = solve('1-exp((t^0.22)*(1/CR)*(exp(-CR*(t^0.78))-1))=0.999725776893977','t')

That will *not* get your definition of CR inserted into the solve
command. Do not use strings. The following probably would work:

CR = 0.012;
syms t;
solve(1-exp((t^0.22)*(1/CR)*(exp(-CR*(t^0.78))-1)) - ...
       0.999725776893977, t)

But that causes a very long computation to happen, because with
fractional exponents, things get hairy in the complex plane, and the
resulting computations have to deal with lengthy rational numbers.
Assuming you have MATLAB 2011b or later, the following works just fine
for me:

CR = 0.012;
syms t;
solve(1-exp((t^0.22)*(1/CR)*(exp(-CR*(t^0.78))-1)) - ...
       0.999725776893977, t, 'Real', true)

ans =

8.4646898405560714165921833287311



Christopher

Subject: Resolve equation in Matlab

From: Darshan

Date: 22 Nov, 2011 15:52:08

Message: 4 of 4

Thanks Christopher

Your suggestion resolved my question.

Best regards,
Dare.

Christopher Creutzig <Christopher.Creutzig@mathworks.com> wrote in message <4ECB968F.9030103@mathworks.com>...
> On 21.11.11 21:45, Darshan wrote:
> > hi
> >
> > I am using the following command to solve the equation in MATLAB
> >
> > CR = 0.012
> > t = solve('1-exp((t^0.22)*(1/CR)*(exp(-CR*(t^0.78))-1))=0.999725776893977','t')
>
> That will *not* get your definition of CR inserted into the solve
> command. Do not use strings. The following probably would work:
>
> CR = 0.012;
> syms t;
> solve(1-exp((t^0.22)*(1/CR)*(exp(-CR*(t^0.78))-1)) - ...
> 0.999725776893977, t)
>
> But that causes a very long computation to happen, because with
> fractional exponents, things get hairy in the complex plane, and the
> resulting computations have to deal with lengthy rational numbers.
> Assuming you have MATLAB 2011b or later, the following works just fine
> for me:
>
> CR = 0.012;
> syms t;
> solve(1-exp((t^0.22)*(1/CR)*(exp(-CR*(t^0.78))-1)) - ...
> 0.999725776893977, t, 'Real', true)
>
> ans =
>
> 8.4646898405560714165921833287311
>
>
>
> Christopher

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