II.1 Programming in MATLAB Getting Started Graphing

II.1 Programming in MATLAB Getting Started Graphing II.1 Programming in MATLAB Getting Started Graphing

12.07.2015 Views

clearmu = 0.5;theta = pi/4;error = 100;betamax = 0;for i = 1:101beta = (i-1)*theta/100;[F,NA]=tfunction(beta,theta);x(i) = beta*180/pi;y(i) = F;FMAX(i)=mu*NA;er = abs(F-FMAX(i));% The function tfunction is called.% Notice that x in test2.m is% different than x in tfunction.m.% Quantities are not passed% between programs.endif er

Key Commandsclc, clear, edit, what, whoReview Questions1. What is the MATLAB desktop?2. Describe the purpose of a semicolon placed at the end of aninstruction.3. What command erases what’s in the command window?4. What command clears all of the variables in the workspace?5. Describe the purpose of the commands who and what.ProblemsA2 – 1A W = 50 lb block rests on a rough surface when the frictionforce F acting on the block is less than µN, in which N denotesthe normal force acting on the block by the surface and µ = 0.5is the static friction coefficient. When F exceeds 0.5N, theblock begins to slide. The friction force F and the normal forceN depend on the incline angle θ by F = 50cosθ and N = 50sinθ.Plot the functions F(θ) and µN(θ) on the same graph letting θrange between 0 and 90 ○ . Determine from the graph the largestangle θ max for which the block remains at rest.Answer: θ max = 26.6 ○ (Note that θ max can also be foundanalytically.)A2 – 2A triangular truss is acted upon by a P = 500 lb load, as shown.The load causes a tensile force of F AB = P/sinθ in member ABand a compressive force of F AC = Pcosθ /sinθ in member AC.Plot F AB + F AC versus θ. For what angle θ is F AB + F ACminimal?Answer: θ min = 60 ○ (Note that θ min can also be foundanalytically.)9

clearmu = 0.5;theta = pi/4;error = 100;betamax = 0;for i = 1:101beta = (i-1)*theta/100;[F,NA]=tfunction(beta,theta);x(i) = beta*180/pi;y(i) = F;FMAX(i)=mu*NA;er = abs(F-FMAX(i));% The function tfunction is called.% Notice that x <strong>in</strong> test2.m is% different than x <strong>in</strong> tfunction.m.% Quantities are not passed% between programs.endif er

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!