Error in line 14 and 15
Show older comments
syms f(x,y) ;
%syms f1(x,y);
%syms f2(x,y);
syms v uj U1 U2;
n= y*sqrt(U1)/(2*x*v);
%f=u/U1;
df = uj/U1 ;
j=1;2;
d2f = diff(df) ;
d3f = diff(d2f) ;
du1 = diff(U1,y);
du2 = diff(U2,y);
ode = d3f+df*d2f == 0 ;
14- cond1 = d2f(sym('inf')) == -1 ;
15- cond2 = d2f(-sym('inf')) == 10;
cond3 = 10*du1 == 60000*20*du2;
%cond4 = y==0 f1(0)= f2(0);
conds= [cond1 cond2 cond3];
result=vpa(dsolve(ode,conds));
%plot (n,u/U1)
Error - Error using sym/subsindex (line 825) Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic variables, and function body must be sym expression.
Error in sym/subsref (line 870) R_tilde = builtin('subsref',L_tilde,Idx);
Error in fianlone (line 14) cond1 = d2f(sym('inf')) == -1 ;
2 Comments
Guillaume
on 9 Nov 2018
If you say you get an error, then you must tell us the full error message you get, everything in red. Don't leave it to us to guess what the error might be, we won't bother and your question won't get answered.
Telling us which lines are line 14 and 15 would also be useful rather than forcing us to count the lines.
Venkata Sai Ram Aripirala
on 9 Nov 2018
Answers (1)
Walter Roberson
on 9 Nov 2018
0 votes
Your df is not a function so d2f is not a function. When you use d2f(sym('inf')) that becomes an attempt to index with a symbol, not a function evaluation.
You should be specifying the variable to differentiate against in your diff calls.
Categories
Find more on Operations on Strings 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!