How do I solve this equation for x given a value of z and y?

z = (10.^(-15).*x.^(3).*exp((x.^2).^(-1)/4).*y.^(-1)).^(1/5)
Is there a way to numerically solve this equation for x given specific values of z and y? I am having trouble imputing the syntax and getting it to run correctly.

 採用された回答

Matt Fig
Matt Fig 2011 年 4 月 25 日

0 投票

Re-write the equation as:
f = @(x)(10.^(-15).*x.^(3).*exp((x.^2).^(-1)/4).*y.^(-1)).^(1/5)-z
Then let FZERO have a crack at it. Note that y and z should be defined before creating that function handle. For example:
z = 0.05;
y = 1/20;
f = @(x) (10.^(-15).*x.^(3).*exp((x.^2).^(-1)/4).*y.^(-1)).^(1/5)-z;
fzero(f,1)

7 件のコメント

William Duhe
William Duhe 2011 年 4 月 25 日
Awesome this did the trick thanks! I was wondering though if its possible to assign a range of values for z and y in order to obtain plots from this?
Matt Fig
Matt Fig 2011 年 4 月 25 日
You will have to loop them, as FZERO expects the function to return a scalar.
William Duhe
William Duhe 2011 年 4 月 25 日
All right, also the other equation that is similar that I need to solve in the same fashion:
z = 0.05;
y = 0.05;
f = @(x) (10.^(-10).*x.^(2).*exp((x.^2).^(-1)/4).*y.^(-1)/2).^(1/4)-z;
fzero(f,1);
I used your recommended syntax but when I I run it it simply doesn't give an answer. It doesn't give an error either it's strange, it's as if nothing happened, I appreciate your help very much.
Matt Fig
Matt Fig 2011 年 4 月 26 日
You have a semicolon on the end of the call to FZERO. If you want to see the answer, either take the semicolon off or assign get the return arg and display that. Example using the parameters copied and pasted from your last comment.
>> rt = fzero(f,1); % Now use rt for further processing...
>> rt % Display what is in rt...
rt =
0.14049
Walter Roberson
Walter Roberson 2011 年 4 月 26 日
[(1/2)/(-LambertW(-1, -1/25000))^(1/2), (1/2)/(-LambertW(-1/25000))^(1/2)]
which is [.1404942646, 79.05536030]
Walter Roberson
Walter Roberson 2011 年 4 月 26 日
Good catch, Matt.
Matt Fig
Matt Fig 2011 年 4 月 26 日
I used to do that one all the time! ;)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Community Treasure Hunt

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

Start Hunting!

Translated by