Sign In | Subscribe

Enter your Sign on user name and password.

Forgot password?
  • Follow us on:
Start learning today, and be successful in your academic & professional career. Start Today!
Loading video...
This is a quick preview of the lesson. For full access, please Log In or Sign up.
For more information, please see full course syllabus of MATLAB
  • Discussion

  • Study Guides

  • Practice Questions

  • Download Lecture Slides

  • Table of Contents

  • Related Books

Start Learning Now

Our free lessons will get you started (Adobe Flash® required).
Get immediate access to our entire library.

Sign up for

Membership Overview

  • Unlimited access to our entire library of courses.
  • Search and jump to exactly what you want to learn.
  • *Ask questions and get answers from the community and our teachers!
  • Practice questions with step-by-step solutions.
  • Download lesson files for programming and software training practice.
  • Track your course viewing progress.
  • Download lecture slides for taking notes.
  • Learn at your own pace... anytime, anywhere!

Program Design & Algorithm Development

  • In attacking each problem you need to have a logical plan and lay out steps that you want to follow, here we have some suggestion for a plan of attack that might work for many problems:
  • Step 1:  Problem analysis.The context of the proposed investigation must be established to provide the proper motivation for the design of a computer program. The designer must fully recognize the need and must develop an understanding of the nature of the problem to be solved.
  • Step 2:  Problem statement.Develop a detailed statement of the mathematical problem to be solved with a computer program.
  • Step 3:  Processing scheme.Define the inputs required and the outputs to be produced by the program.
  • Step 4:  Algorithm.Design the step-by-step procedure using the top-downdesign process that decomposes the overall problem into subordinate problems. The subtasks to solve the latter are refined by designing an itemized list of steps to be programmed. This list of tasks is the structure plan; it is written in pseudocode, i.e. a combination of English, mathematics and anticipated MATLAB commands. The goal is to design a plan that is understandable and easily translated into a computer language.
  • Step 5:  Program algorithm.Translate or convert the algorithm into a computer language (e.g. MATLAB) and debug the syntax errors until the tool executes successfully.
  • Step 6:  Evaluation.Test all of the options and conduct a validation study of the computer program, e.g. compare results with other programs that do similar tasks, compare with experimental data if appropriate, and compare with theoretical predictions based on theoretical methodology related to the problems to be solved by the computer program. The objective is to determine that the subtasks and the overall program are correct and accurate. The additional debugging in this step is to find and correct logicalerrors (e.g. mistyping of expressions by putting a + sign where a − sign was supposed to be placed), and run-timeerrors that may occur after the program successfully executes (e.g. cases where division by 0 unintentionally occurs).
  • Step 7:  Application.Solve the problems the program was designed to solve. If the program is well designed and useful it could be saved in your work directory (i.e. in your user-developed toolbox) for future use.

Program Design & Algorithm Development

Write a program to convert a Fahrenheit temperature to Celsius.

function converFC
F = input('Please input the temperature in F: ');
C = (5/9)*(F-32)
Write a script for the general solution of the quadratic equation ax2+bx+c = 0. Your script should be able to handle all possible values of the data a, b, and c. Try it out on the following values of a, b and c:
(a) 1, 1, 1 (complex roots);
(b) 2, 4, 2 (equal roots of -1.0);
(c) 2, 2, −12 (roots of 2.0 and -3.0).
function quadcalc

a = input('please enter a for the quadratic equation ax 2+b x+c = 0 :');
b = input('please enter b for the quadratic equation ax 2+b x+c = 0 :');
c = input('please enter c for the quadratic equation ax 2+b x+c = 0 :');

delta = b 2-4*a*c;

x1 = (-b + sqrt(delta))/(2*a)
x2 = (-b - sqrt(delta))/(2*a)


*These practice questions are only helpful when you work on them offline on a piece of paper and then use the solution steps function to check your answer.


Program Design & Algorithm Development

Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

  • Intro 0:00
  • Problem Analysis 0:36
    • Problem Statement
    • Processing Scheme
    • Algorithm
    • Program Algorithm
    • Evaluation
    • Application
  • Example: Projectile 3:54
    • Example Executed in MATLAB
    • Txmax
    • Xmax
    • Computing Speed and Angle Direction of Projectile
    • Velocity
  • Computing Time and Horizontal Distance at Max. Altitude 15:05
    • Display Altitude
    • Num2str
    • Plot
    • Figure