我在使用dsolve
符号函数时遇到问题。我收到一条错误消息:
“使用 symfun/subsindex 时出错(第 121 行)
索引值必须是正整数、逻辑或符号变量。VK3 中的错误(第 9 行)
[F(n), G(n), H(n)] = dsolve(diff(F) == F2, diff(G) == G2,..."
这是我的代码。这对某些人来说可能看起来很愚蠢,但我对 Matlab 的经验相对较少。如果有人能告诉我哪里出错了,我将不胜感激。
syms F(n) G(n) H(n) F2(n) G2(n)
c = 1.004e-6;
m = input('Angular Velocity = ');
z = 0:1:20;
r = input('Radial Distance = ');
n = z*sqrt(m/c);
[F(n), G(n), H(n)] = dsolve(diff(F) == F2, diff(G) == G2,...
diff(F2) == F^2 - G^2 + F2*H,...
diff(G2) == 2*F + G2*H,...
diff(H) == -2*F,...
F(0) == 0, H(0) == 0, G(0) == 1, F(20) == 0, G(20) == 0);
U = m*r*F(n);
V = m*r*G(n);
W = sqrt(m/v)*H(n);
subplot(3,1,1)
plot(U,n), xlabel('U'), ylabel('z'),...
title('Radial Velocity Component')
subplot(3,1,2)
plot(V,n), xlabel('V'), ylabel('z'),...
title('Azimuthal Velocity Component')
subplot(3,1,3)
plot(W,n), xlabel('W'), ylabel('z'),...
title('Axial Velocity Component')