for k=1:length(y)
f=@(x)y(k)*x-sin(x);
ezplot(f);%畫圖,觀察函數零點在x0(k)附近
z(k)=fzero(f,x0(k));%呼叫fzero函數找零點
endsxf2012(站內聯繫ta)%%以y為一個資料為例,假設y值為y0,則令
%f=@(x)y0-sin(x)/x;%%用指令:%ezplot(f);
%%畫圖,觀察函數,隨便找零點附近的一個座標x0
%% 則,要的零點為
%z=fzero(f,x0);%呼叫fzero函數找零點
%例如y0=0.6,通過令
f=@(x)0.6-sin(x)/x;%畫圖ezplot(f)hold onplot(,,'r')
%觀察知,零點在-2和2附近,用
z1=fzero(f,-2)
%計算得零點為x=-1.66
z2=fzero(f,2)
%計算得零點為x=1.66
這是y=sinx/x的曲線圖。我的情況是y的值是已知的,我需要把x的全部值出來,也就是想透過反函數來得。但是問題是,y=1時x是一個值,但y=0.8是兩個值,y=0.1就是許多值。
這是y=sinx/x的曲線圖。我的情況是y的值是已知的,我需要把x的全部值出來,也就是想透過反函數來得。但是 ... 在你畫的區間上,函數不是單調的,所以其反函數不存在的,或者說是多值函數。
finv
F inverse cumulative distribution function
Syntax
X = finv(P,V1,V2)
Description
X = finv(P,V1,V2) computes the inverse of the F cdf with numerator degrees of freedom V1 and denominator degrees of freedom V2 for the corresponding probabilities in P. P, V1, and V2 can be vectors, matrice probabilities , or multidimensional arrays that all have the same size. A scalar input is expanded to a constant array with the same dimensions as the other inputs.
The parameters in V1 and V2 must all be positive integers, and the values in P must lie on the interval [0 1].
The F inverse function is defined in terms of the F cdf as
where
Examples
Find a value that should exceed 95% of the samples from an F distribution with 5 degrees of freedom in the numerator and 10 degrees of freedom in the denominator.
x = finv(0.95,5,10)
x =
3.3258
You would observe values greater than 3.3258 only 5% of the time by chance.
以上是學習如何使用MATLAB求解sinc函數的逆函數的詳細內容。更多資訊請關注PHP中文網其他相關文章!