日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 人工智能 > 循环神经网络 >内容正文

循环神经网络

matlab把符号数,Matlab 符号与数值之间的转换

發(fā)布時(shí)間:2023/12/1 循环神经网络 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 matlab把符号数,Matlab 符号与数值之间的转换 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

符號(hào)運(yùn)算得到的是精確的解析解,但是有時(shí)需要進(jìn)行數(shù)值轉(zhuǎn)換,主要通過(guò)以下幾個(gè)函數(shù)實(shí)現(xiàn)。

1.digits 函數(shù)

調(diào)用方法:digits(D)

函數(shù)設(shè)置有效數(shù)字個(gè)數(shù)為D的近似解精度。

2.vpa 函數(shù)

vpa

Variable-precision arithmetic

Syntax

R = vpa(A)

R = vpa(A,d)

Description

R = vpa(A) uses variable-precision arithmetic (VPA) to compute

each element of A to at least d decimal digits of accuracy, where d

is the current setting of digits.

R = vpa(A,d) uses at least d significant (nonzero) digits,

instead of the current setting of digits.

注:vpa中的精度是指有效值,即vpa(1.2345,2)=1.2;vpa(0.2345,2) = 0.23

3.subs函數(shù)

subs

Symbolic substitution

Syntax

g = subs(f,old,new)

g = subs(f,new)

g = subs(f)

g = subs(f,old,new,0)

Description

g = subs(f,old,new) replaces all occurrences of old with new in

f, and then evaluates f.

g = subs(f,new) replaces all occurrences of the default variable

in f (defined by symvar) with new , and then evaluates f.

g = subs(f) replaces symbolic variables in f with their values

obtained from the calling function and the MATLAB workspace, and

then evaluates f. Variables with no assigned values remain as

variables.

g = subs(f,old,new,0) prevents switching the arguments old and

new if subs(f,old,new) returns f. Without this additional argument,

the toolbox also tries subs(f,new,old) if subs(f,old,new) returns

f. This approach provides backwards compatibility with previous

versions and eliminates the need to remember the order of the

arguments.

例1:求方程3*x^2-exp(x) = 0 的精確解和各種精度的近似解

>> s = solve('3*x^2-exp(x) =

0')

s =

-2*lambertw(0, 3^(1/2)/6)

-2*lambertw(0, -3^(1/2)/6)

>> vpa(s)

ans =

-0.45896226753694851459857243243406

0.91000757248870906065733829575937

>> vpa(s,6)

ans =

-0.458962

0.910008

例2:設(shè)函數(shù)為f(x) = x – cos(x) 。求此函數(shù)在x = pi點(diǎn)的值的各種精度的數(shù)值近似形式。

>> x = sym('x');

>> f = x - cos(x)

f =

x - cos(x)

>> f1 = subs(f,x,pi)

f1 =

4.1416

創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來(lái)咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)

總結(jié)

以上是生活随笔為你收集整理的matlab把符号数,Matlab 符号与数值之间的转换的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。