This is a homework assignment so I don't want anyone to write code for me, but I'm tasked with building a fairly complex GUI using GUIDE and I have no experience with that part of MATLAB. I've spent the last hour or so reading GUI materials, but I still don't know how to approach the GUI aspect of this problem.
The first part was easy: I've written a function (included below) that solves the Blasius solution and includes a thermal boundary layer. It then plots the two solutions (the Blasius boundary layer and the thermal boundary layer).
What I want my GUI to do is take the Prandtl number, Pr, and Eta_max, etaMax, as user inputs in a text box, and graph the results with a button press.
So, here's my main question, in two parts:
1. Where in the code do I insert my function? 2. I've designed my GUI using the UI, but how do I share variables between the input text box and the plot, for example?
Thank you in advance for your help!
function thermalboundary Pr = [.07]; % Choose Prandtl
etaMax = [15]; % Choose etaMax
xm = [15]; figure; solinit = bvpinit(linspace(0,etaMax,8),... [0, 0, 0, 0, 0]); sol = bvp4c(@BlasiusT, @BlasiusTbc,... solinit, [], Pr); eta = linspace(0, etaMax); y = deval(sol, eta); subplot(2, 1, 1); plot(eta, y(1,:),'--k',eta,y(2,:),'-k',eta,... y(3,:),':k'); xlabel('\eta'); ylabel('y_1, y_2, y_3'); legend('Stream function f = y_1',... 'Velocity, df/d\eta = y_2', ... 'Shear, d^2f/d\eta^2 = y_3'); axis([0 xm 0 2]); subplot(2, 1, 2); plot(eta, y(4,:), '--k', eta, y(5,:), ':k'); axis([0 xm 0 2]); legend('Temperature, T^* = y_4',... 'Heat flux, dT^*/d\eta = y_5'); xlabel('\eta'); ylabel('y_4, y_5');function F = BlasiusT(eta, y, Pr)F = [y(2); y(3); -0.5*y(1)*y(3); y(5); ... -Pr*0.5*y(1)*y(5)];function res = BlasiusTbc(ya, yb, Pr)res = [ya(1); ya(2); ya(4); yb(2)-1; yb(4)-1];
Best Answer