字符转化为数字问题,求解答。

F(x)=diff(f(x));
g=F(50);
g1=str2double(g);
得出: g
g =
2990798153356952709/1152921504606846976
>> 2990798153356952709/1152921504606846976
ans =
2.5941
>> g1
g1 =
NaN 问题1: 为什么g1的值不是2.5941
问题2: g的value为 1*1 sym 怎么将g的值赋给其他字母

 Risposta accettata

jamasr
jamasr il 28 Ott 2022

0 voti

str2double 是将字符转化为数字,输入为sym,所以为nan
用 vpa(g) 或者 double(g)

Più risposte (0)

Categorie

Tag

Richiesto:

il 28 Ott 2022

Risposto:

il 28 Ott 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!