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, matrices, 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中文网其他相关文章!