Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Matlab中求解x的函数?_Matlab_Octave - Fatal编程技术网

如何在Matlab中求解x的函数?

如何在Matlab中求解x的函数?,matlab,octave,Matlab,Octave,我定义了这个函数: % Enter the data that was recorded into two vectors, mass and period mass = 0 : 200 : 1200; period = [0.404841 0.444772 0.486921 0.522002 0.558513 0.589238 0.622942]; % Calculate a line of best fit for the data using polyfit() p = polyfit(

我定义了这个函数:

% Enter the data that was recorded into two vectors, mass and period
mass = 0 : 200 : 1200;
period = [0.404841 0.444772 0.486921 0.522002 0.558513 0.589238 0.622942];

% Calculate a line of best fit for the data using polyfit()
p = polyfit(mass, period, 1);
fit=@(x) p(1).*x + p(2);

现在我想解f(x)=.440086,但找不到一种方法。我知道我可以很容易地用手算出来,但我想知道将来怎么做。

如果你想解一个线性方程,比如
a*x+B=0
,你可以很容易地在MATLAB中求解,如下所示:

p=[0.2 0.5];
constValue=0.440086;
A=p(1);
B=constValue-p(2);
soln=A\B;
如果你想解一个非线性方程组,你可以使用
fsolve
,如下所示(这里我将展示如何使用它来解上述线性方程):


这两种方法应提供相同的解决方案。

如果要求解线性方程,如
a*x+B=0
,可以在MATLAB中轻松求解,如下所示:

p=[0.2 0.5];
constValue=0.440086;
A=p(1);
B=constValue-p(2);
soln=A\B;
如果你想解一个非线性方程组,你可以使用
fsolve
,如下所示(这里我将展示如何使用它来解上述线性方程):


这两种方法应提供相同的解决方案。

如果要求解线性方程,如
a*x+B=0
,可以在MATLAB中轻松求解,如下所示:

p=[0.2 0.5];
constValue=0.440086;
A=p(1);
B=constValue-p(2);
soln=A\B;
如果你想解一个非线性方程组,你可以使用
fsolve
,如下所示(这里我将展示如何使用它来解上述线性方程):


这两种方法应提供相同的解决方案。

如果要求解线性方程,如
a*x+B=0
,可以在MATLAB中轻松求解,如下所示:

p=[0.2 0.5];
constValue=0.440086;
A=p(1);
B=constValue-p(2);
soln=A\B;
如果你想解一个非线性方程组,你可以使用
fsolve
,如下所示(这里我将展示如何使用它来解上述线性方程):

这两种方法应该提供相同的解决方案