Coupled differential equation to solve fluids
Show older comments
x0_t=@(t) (-3+0.2*sin(0.2*t));
x1_t=@(t) (3+0.1*sin(0.1*t));
x2_t=@t (0.0+0.13*sin(0.13*t));
y0_t= @(t) (1.5+0.12*sin(0.12*t));
y1_t= @(t) (1.5+0.15*sin(0.14*t));
y2_t= @(t) (-3.5+0.05*sin(0.14*t))
r0=@(x,y,t) (((x-x0_t)^2 + (y-y0_t)^2)+0.2);
r1= @(x,y,t) (((x-x1_t)^2+(y-y1_t)^2)+0.2);
r2= @(x,y,t) (((x-x2_t)^2+(y-y2_t)^2)+0.2);
ode1=diff(x)==-5*((y-y0_t(t))/(r0(x,y,t))^2)+5*((y-y1_t(t))/(r1(x,y,t))^2)+5*((x-x2_t(t))/(r2(x,y,t))^2)
ode2=diff(y)==5*((x-x0_t(t))/(r0(x,y,t))^2)-5*((x-x1_t(t))/(r1(x,y,t))^2)+5*((y-y2_t(t))/(r2(x,y,t))^2)
odes=[ode1;ode2]
>> cond1=x(0)==0;
>> cond2=y(0)==0;
>> conds=[cond1;cond2];
>> [xsol(t),ysol(t)]=dsolve(odes,conds)
Warning: Unable to find explicit solution.
> In dsolve (line 190)
Error using sym/subsindex (line 855)
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be
symbolic variables, and function body must be sym expression.
I am a little out of touch with matlab, and need to solve a fluid mechanics problem with it, particularly finding the pathline. Can someone help me with this warning+error. Should I be using ode45 instead of dsolve?
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations 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!