我在使用帶符號功能的dsolve
時遇到了麻煩。我收到錯誤消息,說明:使用symfun/subsindex的MATLAB錯誤
「使用symfun/subsindex(線121)
索引值必須是正整數,邏輯值或符號變量錯誤VK3誤差(第9行)
[F(n)時,G(n)時,H(N)] = dsolve(差異(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')