cs101 hw1

advertisement
CS101-001 Homework 1
1.1
x=0:0.1:10;
y=2*exp(-0.2*x);
plot(x,y)
1.3
>> lookfor logarithm
betaln
gammaln
logspace
logm
log
log10
log2
reallog
utScaledLogm
sbiologf
fi_log2lookup_8_bit_byte
logsig
quatlog
>> lookfor log10
log10
1.4
>> u=1
u=
1
>> v=3
v=
3
(a) >> (4*u)/(3*v)
ans =
0.4444
(b) >> (2*v^2)/(u+v)^2
ans =
1.1250
(c) >> (v^3)/(v^3-u^3)
ans =
1.0385
(d) >> (4/3)*(pi)*(v^2)
ans =
- Logarithm of beta function.
- Logarithm of gamma function.
- Logarithmically spaced vector.
- Matrix logarithm.
- Natural logarithm.
- Common (base 10) logarithm.
- Base 2 logarithm and dissect floating point number.
- Real logarithm.
- Matrix logarithm with pre-scaling.
- Logarithm to a specified base.
- Base-2 logarithm
- Logarithmic sigmoid transfer function.
- Calculate the natural logarithm of a quaternion.
- Common (base 10) logarithm.
1.9
37.6991
1.8
>> mkdir mynewdir
>> addpath mynewdir
1.9
>> mkdir mynewdir
>> addpath mynewdir
>> cd mynewdir
>> test2
*A plot shows up to the corresponding variables in the script.
1.10
>> mkdir mynewdir
>> addpath mynewdir
>> cd mynewdir
>> test2
>> cd ..
>> test2
Undefined function or variable 'test2'.
Did you mean:
>> ttest2
*There is an error in which the script doesn’t run because the directory changed to the parent
directory where test2 is not located. Test2 is located in the directory under mynewdir, which is
not on path.
Download