How do determine the pressure? Please check me my code.
1 回表示 (過去 30 日間)
古いコメントを表示
if true
% code
end
t = 0:0.1:10*pi;
r = linspace (0, 1, numel (t));
z = linspace (0, 1, numel (t));
a = 0.009;
Gamm_inf = 2000;
nu = 3;
p0 = 1;
ro = 2;
vth = (Gamm_inf)./(2*pi*nu.*r);
p_r = p0 + ro.*int(vth*vth./r,r,0,r)-(ro*a^2)/2.*(r^2 + 4.*z^2);
plot(p_r,r);
plot(p_r,z);
plot3(p_r,r,z);
0 件のコメント
採用された回答
Star Strider
2018 年 10 月 9 日
To do numerical integration, you need to use the integral function. Here, it is also necessary to use arrayfun to integrate over your ‘r’ vector. I changed ‘vth’ and also the plots, so ‘p_r’ is plotted as a function of ‘r’ (and ‘z’).
This runs, without errors or warnings. I will let your determine if it is correct:
t = 0:0.1:10*pi;
r = linspace (0, 1, numel (t));
z = linspace (0, 1, numel (t));
a = 0.009;
Gamm_inf = 2000;
nu = 3;
p0 = 1;
ro = 2;
vth = @(r) (Gamm_inf)./(2*pi*nu.*r) .* (1 - exp(-(a*r/(2*nu))));
p_r = p0 + ro.*arrayfun(@(r)integral(@(r)vth(r).*vth(r)./r,1E-8,r, 'ArrayValued',1),r)-(ro*a^2)/2.*(r.^2 + 4.*z.^2);
figure
plot(r, p_r);
grid
figure
plot3(r, z ,p_r);
grid on
Experiment to get the result you want.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!