Appendix A. MATLAB Scripts

Script 1: Graphing volume function for the solution of the beer can example.
%Beer can example; plot volume as function of hclear all;h=0:0.1:8;A0=pi;V=pi∗h.∗(h+(h.ˆ2+4∗A0/pi).ˆ0.5).ˆ2;plot(h,V);xlabel('h: height'); ylabel('V: volume');
Script 2: Graphing surface function f(x1, x2) of Figures 3.9a and b.
%Figure 3.9aclear all;[x1,x2]=meshgrid([-1:0.075:1]);f=(cos(x1).ˆ2+cos(x2).ˆ2).ˆ2;surfc(x1,x2,f)xlabel('x1');ylabel('x2');colormap (hsv) %Figure 3.9bclear all;[x1,x2]=meshgrid([1:0.075:1]);f=(cos(x1).ˆ2+cos(x2).ˆ2).ˆ2;surfc(x1,x2,f)xlabel('x1');ylabel('x2');colormap (hsv)
Script 3: Graphing surface function f(x1, x2) and iso-lines of f(x1, x2) at (x1, x2) = (1, 1) and (x1, x2) = (1, 1) of Example 3.2.
%Surface figure ...

Get Design Theory and Methods using CAD/CAE now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.