bvp with constant vector in function definition
Ältere Kommentare anzeigen
My problem seems simple: U''(r)=-4*pi*r*n(r) where n(r) is a constant 1d-vector In addition I have the boundary conditions: U(0)=0 and U(r_max)=c, where c is a constant.
I've tried the following:
f = @(r,U) [ U(2); -4*pi.*r.*n];
g = @(ya,yb) [ya(1); yb(1)-c];
solinit=bvpinit(linspace(0,r_max,10),[0 0]);
sol = bvp4c(f,g,solinit);
In case n is just a number it works... For n being a vector it doesn't and i get the error:
Error using vertcat Dimensions of matrices being concatenated are not consistent.
Is there any way to include vectors in my function definition?
Thanks in advance.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Boundary Value Problems finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!