Why doesn't get a numerical value
1 view (last 30 days)
Show older comments
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
0 Comments
Answers (1)
madhan ravi
on 27 Dec 2018
Edited: madhan ravi
on 27 Dec 2018
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
0 Comments
See Also
Categories
Find more on Number Theory in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!