CS101 section 003 Computer Programming and Problem Solving - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

CS101 section 003 Computer Programming and Problem Solving

Description:

Using the MATLAB product, you can solve technical computing problems faster than ... Variables are a fundamental concept in MATLAB, and you will use them all the time. ... – PowerPoint PPT presentation

Number of Views:33
Avg rating:3.0/5.0
Slides: 23
Provided by: Tian92
Category:

less

Transcript and Presenter's Notes

Title: CS101 section 003 Computer Programming and Problem Solving


1
CS101 section 003Computer Programming
and Problem Solving
  • Venkata Gopal Edupuganti
  • Department of Computer Science
  • Email vge2_at_njit.edu
  • Office GITC 4324
  • Web http//web.njit.edu/vge2

2
Text Book (not required)
  • MATLAB Programming for Engineers
  • 4th Edition
  • Stephen J. Chapman
  • Thomson
  • ISBN-13 978-0-495-24449-3
  • ISBN-10 0-495-24449-X

3
Course structure
  • Mid-Term (30 points).
  • Final exam (40 points).
  • Assignments (20 points).
  • Attendance (10 points).

4
MATLAB
  • MATLAB is a high-level technical computing
    language and interactive environment for
    algorithm development, data visualization, data
    analysis, and numeric computation.
  • Using the MATLAB product, you can solve technical
    computing problems faster than with traditional
    programming languages, such as C, C, and
    Fortran.

5
Why MATLAB?
  • Ease of use
  • Platform independence
  • Predefined functions
  • Device independent plotting
  • Graphical user interface
  • MATLAB compiler

6
Official website
  • www.mathworks.com

7
Free MATLAB!
  • MATLAB R2007a library
  • MATLAB R2008a (b)
  • MATLAB R2009a
  • ist.njit.edu
  • UCID
  • VPN

8
MATLAB Workspace
9
Interactive Calculation
10
Be careful about the priorities of different
operations!
  • 1.4 ( 27 - 5 )
  • 1
  • -------
  • 5.83.6
  • ? 5 2

11
Interactive Calculation
12
  • a1
  • b2
  • cab
  • c?

13
Variable
  • Variables are a fundamental concept in MATLAB,
    and you will use them all the time.
  • Basically, a variable is a holding place for a
    value which you can give a name to.
  • The point of this is that, when calculating
    something new later, you can use the value that a
    variable refers to as part of the new
    calculation.

14
Interactive Calculation
15
  • max31 (valid)
  • 3max1 (invalid)
  • max_31 (valid)
  • max 31 (invalid)

16
Interactive Calculation
17
  • a1
  • b2
  • cab
  • Now see your command history window, workspace
    and also try whos in your command window

18
disp( )
  • Display text or array
  • Syntax
  • disp(X)
  • disp(X) displays an array, without printing the
    array name. If X contains a text string, the
    string is displayed.

19
disp( ) examples
  • disp(' My name is Tina')
  • Result ? My name is Tina
  • value5
  • disp(value)
  • Result ? 5

20
disp( ) examples
  • You also can use the disp command to display a
    hyperlink in the Command Window. Include the full
    hypertext string on a single line as input to
    disp
  • disp('lta href "http//www.mathworks.com"gtThe
    MathWorks Web Sitelt/agt')
  • which generates this hyperlink in the Command
    Window
  • The MathWorks Web Site

21
  • Excise 1.4
  • In your command window, create a variable called
    radius with value 2.5, calculate the area of the
    circle with the given radius and give the value
    to another variable called area. Display the
    variable area.

22
  • Calculate the velocity (ft/sec) when
    accelaration32.2 ft/sec/sec and time5 sec with
    the following formula velocity acceleration
    time
Write a Comment
User Comments (0)
About PowerShow.com