%
% Math 451 - DeLillo - diary for 8/29/12
%
% There is a homework problem at the end
%
% See also the script file add.m and the function addmult.m
%
t=-1:.01:1;
length t
ans =
1
length(t)
ans =
201
p=poly([1 2 3],t);
{?? Error using ==> poly
Too many input arguments.
}
p=polyval([1 2 3],t);
plot(t,p)
home
clear
x=[-1 0 1 2];
(x>0) & x<1)
??? (x>0) & x<1)
|
{Error: Unbalanced or unexpected parenthesis
or bracket.
}
(x>0) & (x<1)
ans =
0 0 0 0
(x>0)
ans =
0 0 1 1
(x>0) & (x<3)
ans =
0 0 1 1
A=eye(10);
spy(A)
A=rand(100);
B=triu(A);
spy(B)
spy(bucky)
% see Pratap book list of commands on p. 12
pwd
ans =
/home/user33/Documents/MATLAB/451_delillo
home
pwd
ans =
/home/user33/Documents/MATLAB/451_delillo
dir
. m451_8_22_12 testing.txt
.. m451_8_27_12 testing.txt~
lutx.m m451_8_29_12
ver
-------------------------------------------------------------------------------------
MATLAB Version 7.10.0.499 (R2010a)
MATLAB License Number: 113332
Operating System: Linux 2.6.32-131.6.1.el6.i686.thinclient #1 SMP Wed Aug 10 03:12:07 PDT 2011 i686
Java VM Version: Java 1.6.0_12-b04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
-------------------------------------------------------------------------------------
MATLAB Version 7.10 (R2010a)
Global Optimization Toolbox Version 3.0 (R2010a)
Optimization Toolbox Version 5.0 (R2010a)
Partial Differential Equation Toolbox Version 1.0.16 (R2010a)
Statistics Toolbox Version 7.3 (R2010a)
Symbolic Math Toolbox Version 5.4 (R2010a)
^c
??? ^c
|
{Error: Unexpected MATLAB operator.
}
ontrol c kills current command
{??? Undefined function or method 'ontrol'
for input arguments of type 'char'.
}
% control c kills current command
home
3*2+2
ans =
8
2+3*2
ans =
8
3^2+2
ans =
11
2+2+3
ans =
7
(3^2)+2
ans =
11
% Chap 3 of Driscoll's book
%m-files = scripts or functions
% they contain matlab commands
edit
home
add
ans =
4
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
add
ans =
4
% m-file add is
% % addition
% 2 +2
% above was a script file
% now we'll make a function file
edit
clear
home
addmult
{??? Input argument "x" is undefined.
Error in ==> addmult at 3
a = x+y;
}
uiopen('/home/user33/Documents/MATLAB/451_delillo/addmult.m', true);
addmult(2,3)
ans =
5
[c,d]=addmult(2,3)
c =
5
d =
6
whos
Name Size Bytes Class Attributes
ans 1x1 8 double
c 1x1 8 double
d 1x1 8 double
home
whos
Name Size Bytes Class Attributes
ans 1x1 8 double
c 1x1 8 double
d 1x1 8 double
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
add
x1 =
4
% x and y are local to addmult
whos
Name Size Bytes Class Attributes
ans 1x1 8 double
c 1x1 8 double
d 1x1 8 double
x1 1x1 8 double
addmult(2,3)
ans =
5
add
x1 =
4
home
add
x1 =
4
whos
Name Size Bytes Class Attributes
ans 1x1 8 double
c 1x1 8 double
d 1x1 8 double
x1 1x1 8 double
x2 1x1 8 double
y2 1x1 8 double
c
c =
5
d
d =
6
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
add
x1 =
4
{??? Undefined
function or variable
'x'.
Error in ==> add at 6
if x == 0
}
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
add
x1 =
4
{??? Undefined
function or variable
'x'.
Error in ==> add at 6
if x == 0
}
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
add
x1 =
4
home
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
add
x1 =
4
whos
Name Size Bytes Class Attributes
ans 1x1 8 double
c 1x1 8 double
d 1x1 8 double
d1 1x1 8 double
x1 1x1 8 double
x2 1x1 8 double
y2 1x1 8 double
d1
d1 =
1.5000
uiopen('/home/user33/Documents/MATLAB/451_delillo/m451_8_22_12',1)
% HW #2 due M 9/10/12: prob 3.1 from Driscoll's book
% name your files, in general with filename_firstlastname
% e.g. quadform_tdelillo.m
diary off