想知道在MATLAB中,通过取对数将幂函数化为线性函数应该怎样写程序?

首先ln y = ln a + bln w

matlab取对数 matlab取对数命令matlab取对数 matlab取对数命令


matlab取对数 matlab取对数命令


代码如下:

>> x=[56 62 69 77 85 94 105];

y=[305 327 358 380 394 418 436];

x1 = log(x);y1=log(y);

p = polyfit(x1,y1,1);

b=p(1);

a = exp(p(2));

yfit = ax.^b;

plot(x,y,'rp');

hold on

plot(x,yfit,'b-s');

legend('y','yfit')

a和b分别为

a =31.7226;b = 0.5670

matlab如何求对数,matlab中怎么求对数?

1、matlab设置了很多种求对数的函数,首先是自然数对数 log(x),在MATLAB主窗口中输入2.7183的自然数对数,回车后可以看到其值近似为1:

2、然后是用来求以2为底数的对数 log2(x)函数,同样的这里在MATLAB中求4的以2为底的对数的值,其结果为2:

3、接着是以10为底数的对数 log10(x)函数,这里求10的以10为底的对数的值,结果为1:

4、matlab没有提供求其他底数对数的函数,因此需要求其他底数对数logM(N)的时候,需要用公式进行一个简单变换,即“logM(N)=log(N)/log(M)”。以上就是matlab中求对数的相关函数的介绍:

如何在matlab中求对数

log(x)

以自然对数为底的对数。数学上的ln(x)

log10(x)

以10为底的对数。数学上的lg(x)

log2(x)

以2为底的对数

其它为底的,请自行通过换底公式进行计算。

MATLAB中的自然对数e,是怎么表示的

>> log(10)

ans =

2.3026

>> log10(10)

ans =

1

>> log

LOG Natural logarithm.

LOG(X) is the natural logarithm of the elements of X.

Complex results are produced if X is not itive.

See also log1p, log2, log10, exp, logm, reallog.

log 就是自然对数函数,如 log(10)

log10才是以10为底的。

matlab中,怎么通过取对数将幂函数形式转化为线性形式?

在matlab中,怎么通过取对数将幂函数形式转化为线性形式?

首先,将对已知数据取自然对数(常用对数也可以),即w1=log(W),y1=log(y)

其二,对 y=aw^b ,两边取对数,将幂函数转换成线性函数即

y1=log(y)=log(a)+blog(w)=a1+a2w1

matlab取对数 matlab取对数命令


其三,使用regress最小二乘法回归函数,求出系数a1和a2,即

[a,bint,r,rint,stats] = regress(y1,X);

其四,反算a和b系数,即a=exp(a1),b=a2

其五,计算决定系数R2和F统计量及其概率值,即

R2=stats(1);

F=stats(2);

p=stats(3);

matlab 求取对数正态分布参数

你输入

longnrnd后有段显示如下:

r

=

lognrnd(mu,sigma)

returns

an

array

of

matlab取对数 matlab取对数命令


random

numbers

generated

from

the

lognormal

distribution

with

parameters

mu

and

sigma.

mu

and

sigma

are

the

mean

and

standard

deviation,

respectively,

of

the

associated

normal

distribution.

mu

matlab取对数 matlab取对数命令


and

sigma

can

be

vectors,

matrs,

or

multidimensional

arrays

that

he

the

same

size,

which

is

also

the

size

of

r.

a

scalar

input

for

mu

or

sigma

is

expanded

to

a

constant

array

with

the

same

dimensions

as

the

other

input.

这段文字明确的告诉你了,

r

=

lognrnd

(mu,sigma),返回一个随机产生的对数正态分布

mu和sigma的均值和标准,mu和sigma可以是

vectors,

matrs,

or

multidimensional

array,他们具有相同的大小,和产生的r是一样的。

我翻译水平有限,你自己翻译看看,体会里面的意思吧.

你说的是方为2.9,不是标准,

还有问题的话你自己琢磨,多看看文件有很大的帮助