I'm having trouble using dsolve
with symbolic functions. I'm receiving an error stating:
"Error using symfun/subsindex (line 121)
Indexing values must be positive integers, logicals or symbolic variables.Error in VK3 (line 9)
[F(n), G(n), H(n)] = dsolve(diff(F) == F2, diff(G) == G2,..."
Here's my code as it stands. This may seem stupid to some, but I have relatively little experience with Matlab. If anyone could tell me where I'm going wrong, I'd be grateful.
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')