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일
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

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?
You will have to loop them, as FZERO expects the function to return a scalar.
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.
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
[(1/2)/(-LambertW(-1, -1/25000))^(1/2), (1/2)/(-LambertW(-1/25000))^(1/2)]
which is [.1404942646, 79.05536030]
Good catch, Matt.
I used to do that one all the time! ;)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by