This preview shows pages 1–3. Sign up to view the full content.
Solutions
ChE132B
HW1
20pt
Problem 1
part (a) 3pt
The values of pi, i, and j are 3.14159…,
, and
, respectively as shown by the MATLAB Input/Output
below:
>> pi
ans =
3.1416
>> i
ans =
0 + 1.0000i
>> j
ans =
0 + 1.0000i
If any of these constants, pi, i, or j are redefined in the Command Window, then their value is whatever
has been assigned.
However, even if their values have been redefined in the Command Window, their
values remain 3.14159…,
, and
, respectively, in an Mfile so that you do not have to worry about the M
file not working as designed because one or more of the constants pi, i, or j have been redefined in the
Command Window.
You can demonstrate this by running the following Mfile (test.m) after you have
redefined any or all of the constants, pi, i, or j:
function[]=test()
x=pi
y=i
z=j
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document >> test()
x =
3.1416
y =
0 + 1.0000i
z =
0 + 1.0000i
Part (b) 3pt
MATLAB Input/Output from Command Window
>> log(10)
ans =
2.3026
>> log2(10)
ans =
3.3219
>> log(1)
ans =
0 + 3.1416i
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 02/12/2012 for the course CHE 132b taught by Professor Ceweb during the Fall '09 term at UCSB.
 Fall '09
 Ceweb

Click to edit the document details