Why doesn't get a numerical value

i have assigned all the Variable that i have to assign,but why not get a numerical value?
codes are as this
%此处如果不行可以单独拿出来
clc;
clear all;
close all;
syms n a d
%sn=n*pi/2*diff(besseli(0,n*pi*a/d),a)/(besseli(0,n*pi*a/d))
sn=(pi^2*n^2*besseli(1, (pi*a*n)/d))/(2*d*besseli(0, (pi*a*n)/d));
h=2;%水深
D1=0.8060;%圆柱吃水深度
a=2.2497;%圆柱半径
%d=h-D1;%圆柱底部到水底的距离
d=1.1940;
s0=vpa(subs(sn,n,0),5)
s1=vpa(subs(sn,n,1),5)
s2=vpa(subs(sn,n,2),5)
%s0=0.;
%s1=3.76552;
%s2=15.8176;
and the result are as this
s0 =
0.0
s1 =
(4.9348*besseli(1.0, (3.1416*a)/d))/(d*besseli(0.0, (3.1416*a)/d))
s2 =
(19.739*besseli(1.0, (6.2832*a)/d))/(d*besseli(0.0, (6.2832*a)/d))
>>
why

回答(1 个)

madhan ravi
madhan ravi 2018-12-27
编辑:madhan ravi 2018-12-27
Use should use subs() all at once (instead your variables are still symbolic) but below is another work around :
%此处如果不行可以单独拿出来
clc;
clear all;
close all;
syms n
h=2;%水深
D1=0.8060;%圆柱吃水深度
a=2.2497;%圆柱半径
%d=h-D1;%圆柱底部到水底的距离
d=1.1940;
%sn=n*pi/2*diff(besseli(0,n*pi*a/d),a)/(besseli(0,n*pi*a/d))
sn=(pi^2*n^2*besseli(1, (pi*a*n)/d))/(2*d*besseli(0, (pi*a*n)/d));
s0=vpa(subs(sn,n,0),5)
s1=vpa(subs(sn,n,1),5)
s2=vpa(subs(sn,n,2),5)
Gives:
s0 =
0.0
s1 =
3.7655
s2 =
15.818

类别

帮助中心File Exchange 中查找有关 Mathematics 的更多信息

产品

版本

R2014a

标签

Community Treasure Hunt

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

Start Hunting!

Translated by