Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Increasing number of points bvp4c

Asked by pxg882 on 26 Nov 2012

I'm running the following script

function M = SwirlingFlow(~)  
M = bvpinit(linspace(0,20,241),@VKinit);
options = bvpset('RelTol',1e-6);
sol = bvp4c(@VK,@VKbc,M,options);
figure;
hold all;
plot(sol.x,sol.y(2,:)); 
plot(sol.x,sol.y(4,:));  
hold off;
xlabel('\zeta')
xlabel('\zeta')
hleg = legend('F\prime','G\prime','Location','NorthEast'); %#ok<NASGU>
figure;
hold all;
plot(sol.x,sol.y(1,:)); 
plot(sol.x,sol.y(3,:)); 
plot(sol.x,(-1)*sol.y(5,:)); 
hold off;
xlabel('\zeta')
hleg = legend('F','G','-H','Location','East'); %#ok<NASGU>
disp('Value of F''(0)')
a = sol.y(2,1);
disp(a)
disp('Value of G''(0)')
b = sol.y(4,1);
disp(b)
disp('Value of H(infinity)')
c = sol.y(5,end);
disp(c)
function yprime = VK(~,y)
yprime = [  y(2) 
            y(1)^2 - y(3)^2 + y(2)*y(5)
            y(4)
            2*y(1)*y(3) + y(4)*y(5)
            -2*y(1)];
function res = VKbc(ya,yb)
res = [ya(1);ya(3)-1;ya(5);yb(2)-(yb(5)*yb(1));yb(4)-(yb(5)*yb(3))];
function yinit = VKinit(~)
yinit = [0;0.510233;1;-0.615922;0];

However the solution only converges to the correct solution using 241 integration points or less. Anything greater than this and the solution diverges from the true solution. Does anybody know how I would be able to increase the number of points whilst still producing the true solution?

Thanks.

0 Comments

pxg882

Tags

Products

No products are associated with this question.

0 Answers

Contact us