using ode45 to find streamline
Show older comments
Hello, I am using ode45 to get the integration but keep getting errors. I am confused. The variables are x,y and s

Here is my code:
xyinit=[0;0];
[t,xy]=ode45(@uvfun,[1,9],xyinit);
function [uv]=uvfun(t,xy,s)
% consider n=19
n=19;
xi=[];
for i=1:n
xi=[xi,i/(n+1)];
end
% consider yi=0
yi=zeros(size(xi));
s=sym('s',[n,1]);
xy=sym('xy',[2,1]);
uv=zeros(size(xy));
uv=[1;0];
for i=1:n
uv=uv+[uv(1)+s(i)*(xy(1)-xi(i))/((xy(1)-xi(i))^2+(xy(2)-yi(i)^2));uv(2)+s(i)*(xy(2)-yi(i))/((xy(1)-xi(i))^2+(xy(2)-yi(i)^2))];
end
end
1 Comment
Star Strider
on 28 Jan 2018
The equations in the image do not appear to be ordinary differential equations.
You only need to do a summation for each.
Answers (1)
Jan
on 28 Jan 2018
0 votes
ode45 calculates the integral numerically. You cannot provide the derivatives as symbolic variables.
Is u and v the derivative of your function or do you want to calculate a sum?
3 Comments
Tianyu Zhou
on 28 Jan 2018
Jan
on 28 Jan 2018
"s is the unknown matrix"? You cannot integrate a function numerically, which includes an unknown matrix. If you want a symbolic solution, you cannot plot x and y. So start with finding out, what you want to obtain.
Tianyu Zhou
on 28 Jan 2018
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!