Given y, how do I find the value for x?

I plotted the function:
x = 0:0.01:2;
y=(1.96./x).*(1-exp(-0.83.*x));
I want to know the x value when y=1. I want to use an interp1 function, but that will only give me y values. Is there a function to find x values?
Also, I can't get my x-axis correct. I want it to span 0-2 (the value I'm looking for is around 1.3) with step sizes of 0.001 (for more precision). Currently, it goes 0 to 200 and I'm at a loss of what to do.
Thanks for the help.

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2013년 9월 18일

0 개 추천

>> f2 = @(y)arrayfun(@(y)fzero(@(x)1.96./x.*(1-exp(-0.83.*x))-y,1),y);
>> f2([.03 1 12])
ans =
65.333 1.2859 -3.8605

댓글 수: 1

Will
Will 2013년 9월 18일
Thanks! That gets me the correct answer. However, my matlab understanding is very limited, could you explain a little more how the fzero function and the arrayfun work?
Also, I still have the issue with my x axis being on the wrong order of magnitude.

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

추가 답변 (0개)

카테고리

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

질문:

2013년 9월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by