using ode45 to find streamline
Mostrar comentarios más antiguos
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 comentario
Star Strider
el 28 de En. de 2018
The equations in the image do not appear to be ordinary differential equations.
You only need to do a summation for each.
Respuestas (1)
Jan
el 28 de En. de 2018
0 votos
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 comentarios
Tianyu Zhou
el 28 de En. de 2018
Jan
el 28 de En. de 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
el 28 de En. de 2018
Categorías
Más información sobre Ordinary Differential Equations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!