Lecture 3 Notes

2f 27 13014 28 13014 using what weve reviewed remark

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ated before the assignment operation Can do things like increment a variable n༆  n༆  x=x+1 Expression on rhs is evaluated before the assignment operation Can do things like increment a variable x=x+1 n༆  n༆  1/30/14 10.567 A 3.0 17 Here, final x is prior x + one Assumes x has a prior value! 1/30/14 18 1/31/14 Predefined Constants Assignment n༆  n༆  In general, any variable on the rhs must be initialized (i.e., have been given a value) •  Matlab provides a few pre- ini=alized variables pi IEEE floa=ng point approx. of pi Inf IEEE floa=ng point rep. for +infinity Examples: •  You can OVERWRITE them, pi = 7;! y= 1+x % x must be previously set z= 4^2 – cos(y) !Inf = 1;! •  But this is a very bad prac=ce L༄ (except for i and j) 16 1/30/14 1/30/14 Input & Output n༆  Substitution sequences (conversion specifications) variable = input(‘prompt ’) n༆  fprintf(‘message to print ’) fixed point (or floati...
View Full Document

This document was uploaded on 03/11/2014 for the course CSCI 004 at Brown.

Ask a homework question - tutors are online