Error using dsolve, any help would be greatly appreciated

1 view (last 30 days)
Hi there, I'm having trouble using dsolve with symbolic functions; when I try to run I'm receiving an error stating:
"Warning: Explicit solution could not be found.
> In dsolve (line 201)
In VK3 (line 9)
Error using sym/subsasgn (line 832)
Invalid indexing or function definition. When defining a function, ensure that the arguments are symbolic variables
and the body of the function is a SYM expression. When indexing, the input must be numeric, logical, or ':'."
Here's my code as it stands. I appreciate this may seem stupid to some, but I have relatively little experience with matlab, and if anyone would be kind enough to tell me where I'm going wrong, I'd be very greatful.
syms F(n) G(n) H(n)
c = 1.004e-6;
m = input('Angular Velocity = ');
z = linspace(0,20,20);
r = input('Radial Distance = ');
n = z*sqrt(m/c);
[F(n), G(n), H(n)] = dsolve(diff(F,2) == -G*2 + F*2 + diff(F)*H,...
diff(G,2) == 2*F*G + H*diff(G),...
diff(H) == -2*F,...
F(0) == 0, H(0) == 0, G(0) == m*r, F(20) == 0, G(20) == 0);
U = m*r*F(n);
V = m*r*G(n);
W = sqrt(m/v)*H(n);
subplot(1,3,1)
plot(U,n), xlabel('U'), ylabel('z'),...
title('Radial Velocity Component')
subplot(1,3,2)
plot(V,n), xlabel('V'), ylabel('z'),...
title('Azimuthal Velocity Component')
subplot(1,3,3)
plot(W,n), xlabel('W'), ylabel('z'),...
title('Axial Velocity Component')

Answers (1)

RahulTandon
RahulTandon on 7 Jul 2015
Edited: Walter Roberson on 8 Jul 2015
%{
diff(F,2) == -G*2 + F*2 + diff(F)*H,...
diff(G,2) == 2*F*G + H*diff(G),...
diff(H) == -2*F,...
F(0) == 0, H(0) == 0, G(0) == m*r, F(20) == 0, G(20) == 0
%}
%%SECTION 1
% REPHRASING YOU PROBLEM
syms z n m r c F(n) G(n) H(n)
c = 1.004e-6;
m = 200*pi ; % sample value; input('Angular Velocity = ');
r = 10000; % sample value; input('Radial Distance = ');
str1 = 'D2F ==-2*G + 2*F + H*DF';
str2 = 'DH == -2*F';
str3 = 'F(0) == 0';
str4 = 'G(0) == m*r';
str5 = 'F(20) == 0';
str6 = 'G(20) == 0';
str7 = 'D2G == 2*F*G + H*DG';
clc;
for z = linspace(0,20,20)
n = z*sqrt(m/c);
[F, G, H] = dsolve(str7,str1, str2, str3, str4, str5, str6,'n')
end

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!