Why doesn't get a numerical value
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (1개)
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
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Number Theory에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!