Professional Documents
Culture Documents
Plots of Question 3.2 and 3.4
Plots of Question 3.2 and 3.4
if beta > .5
alpha_0 = 1;
else
alpha_0 = .2;
end
alpha_1 = alpha_0 * 1.001;
%% ================================ call ode45 to start secant method =========
[eta,f_0] = ode45(@falkner_skan_ode,linspace(0,eta_max,n),[0 0 alpha_0],options);
error = f_0(end,2) - 1;
converged = 0;
if (abs(error) < threshold)
fprintf(1,'Converged. Value of f``(0) is %f\n',alpha_0);
converged = 1;
end
if converged == 0
% second guess
[eta,f_1] = ode45(@falkner_skan_ode,linspace(0,eta_max,n),[0 0 alpha_1],options);
error = f_1(end,2) - 1;
if (abs(error) < threshold)
fprintf(1,'Converged. Value of f``(0) is %f\n',alpha_1);
converged = 1;
end
end
if converged == 0
alpha_cur = alpha_1;
alpha_old = alpha_0;
% now we start the secant iteration
while (abs(error) > threshold)
slope = (f_1(end,2) - f_0(end,2)) / (alpha_cur - alpha_old);
correction = -error / slope;
alpha_old = alpha_cur; f_0 = f_1;
alpha_cur = alpha_cur + correction;
[eta,f_1] = ode45(@falkner_skan_ode,linspace(0,eta_max,n),[0 0 alpha_cur],options);
error = f_1(end,2) - 1;
end
fprintf(1,'Converged.
plot(eta,f_line2_plot(:,2),'o');
hold on;
plot(eta,f_line2_plot(:,3),'s');
hold on;
leg1 = strcat('\beta = ',mat2str(beta_range(1)));
leg2 = strcat('\beta = ',mat2str(beta_range(2)));
leg3 = strcat('\beta = ',mat2str(beta_range(3)));
legend(leg1,leg2,leg3);
xlabel('\eta', 'FontSize', 20);ylabel(sprintf(['f\\prime\\prime']), 'FontSize', 20);
axis([0 5 min(f_line2_plot(:,1)) 1]);
%------------------------- f' over beta------------------------figure();
plot(beta_range,f_line_plot(2,:),'LineWidth',3);
hold on;
xlabel('\beta', 'FontSize', 20);ylabel(sprintf(['f\\prime']), 'FontSize', 20);
axis([min(beta_range) max(beta_range) min(f_line_plot(:,1)) max(f_line_plot(:,1))]);
%------------------------- f'' over beta------------------------figure();
plot(beta_range,f_line2_plot(1,:),'LineWidth',3);
hold on;
xlabel('\beta', 'FontSize', 20);ylabel(sprintf(['f\\prime\\prime']), 'FontSize', 20);
axis([min(beta_range) max(beta_range) min(f_line_plot(:,1)) max(f_line_plot(:,1))]);
end