想請問一下,我寫了以下的碼
T = input('Key in Period , T= ');
d = input('Key in water depth , d= ');
w=(2*pi)/T;g=9.8;dk=0.1;
syms k;
f=g*k*tanh(k*d)-w^2;
df=diff(f)
k = input('Key in initial k, k= ');
df=subs(df)
在這裡我把 T,d,k 都是輸入10
輸出結果如以下
Key in Period , T= 10
Key in water depth , d= 10
df =
(49*tanh(10*k))/5 - (49*k*(10*tanh(10*k)^2 - 10))/5
Key in initial k, k= 10
df =
(49*tanh(100))/5 - 980*tanh(100)^2 + 980
f =
98*tanh(100) - 3555899736243219/9007199254740992
以上是輸出的結果
我想請問一下有沒有辦法把 df 跟 f的值,直接的計算出來
而不是這樣的情況
(49*tanh(100))/5 - 980*tanh(100)^2 + 980
98*tanh(100) - 3555899736243219/9007199254740992
麻煩一下了 謝謝

 Réponse acceptée

hovers
hovers le 28 Oct 2022

0 votes

df = vpa(df)
f = vpa(f)

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!