下面是我的 MATLAB 代码,用于生成波速 (c) 的虚部,当雷诺数为 249 并且我想以 2 为步长在 0.1 到 2 之间运行波数 (alpha) 时,使用函数 oscalcpcf。
c1holder = [];
c2holder = [];
reyholder = [];
alphaholder = [];
wantedrey = [];
wantedalpha = [];
for Rey = 249
for alpha = 0.1:0.1:2
c1=oscalcpcf(Rey,alpha,100);
c2=oscalcpcf(Rey,alpha,200);
c1holder = [c1holder c1];
c2holder = [c2holder c2];
reyholder = [reyholder Rey];
alphaholder = [alphaholder alpha];
end
end
vectors = [c1holder' c2holder' reyholder' alphaholder'];
在我看来,上面的代码一点也不难,但是我的笔记本电脑因为一些雷诺数和阿尔法而变得暴躁。只需命名其中一个,Reynolds number = 249
并且alpha = 0.3
.
当我运行上面的代码时,我得到c1 = 6.06002472332094E-08
and c2 = 0.0000010870344982811
。
现在问题来了。如果我用步骤从2
到运行,我得到和。0.1
-0.1
c1 = -0.337584041016646
c2 = 0.0000364854401656638
oscalcpcf
如果我要使用, 即oscalcpcf(249,0.3,100)
and手动检查oscalcpcf(249,0.3,200)
,我会得到c1 = -0.337583911335139
and c2 = -0.337577395716528
。
我真的不知道这里发生了什么,有人可以帮忙!
编辑
alpha: 2.000000000000000000000000000000
alpha: 1.899999999999999900000000000000
alpha: 1.800000000000000000000000000000
alpha: 1.700000000000000000000000000000
alpha: 1.600000000000000100000000000000
alpha: 1.500000000000000000000000000000
alpha: 1.399999999999999900000000000000
alpha: 1.299999999999999800000000000000
alpha: 1.200000000000000000000000000000
alpha: 1.100000000000000100000000000000
alpha: 1.000000000000000000000000000000
alpha: 0.899999999999999910000000000000
alpha: 0.799999999999999820000000000000
alpha: 0.699999999999999960000000000000
alpha: 0.599999999999999870000000000000
alpha: 0.500000000000000000000000000000
alpha: 0.399999999999999910000000000000
alpha: 0.299999999999999820000000000000
alpha: 0.199999999999999960000000000000
alpha: 0.099999999999999867000000000000
并且0.1
为了2
alpha: 0.100000000000000010000000000000
alpha: 0.200000000000000010000000000000
alpha: 0.300000000000000040000000000000
alpha: 0.400000000000000020000000000000
alpha: 0.500000000000000000000000000000
alpha: 0.599999999999999980000000000000
alpha: 0.700000000000000070000000000000
alpha: 0.800000000000000040000000000000
alpha: 0.900000000000000020000000000000
alpha: 1.000000000000000000000000000000
alpha: 1.100000000000000100000000000000
alpha: 1.200000000000000200000000000000
alpha: 1.300000000000000300000000000000
alpha: 1.400000000000000100000000000000
alpha: 1.500000000000000200000000000000
alpha: 1.600000000000000100000000000000
alpha: 1.700000000000000200000000000000
alpha: 1.800000000000000300000000000000
alpha: 1.900000000000000100000000000000
alpha: 2.000000000000000000000000000000
我的天啊,为什么我的电脑没有给出0.1
我告诉它这样做的精确步骤。该函数oscalcpcf
对 中的微小变化非常敏感alpha
,当我检查我的脚本使用的这些值时,如果我手动执行它,它匹配oscalcpcf
。你能建议我的电脑给出精确步骤的方法0.1
吗?谢谢你。