Matlab1
docx
keyboard_arrow_up
School
University of California, San Diego *
*We aren’t endorsed by this school
Course
18
Subject
Mathematics
Date
Apr 3, 2024
Type
docx
Pages
9
Uploaded by SargentMask12558
Exercise 1.1
What is the date of your MATLAB quiz? What day of the week is that?
0:00 am PT on Wednesday, June 7th until 11:59 pm PT on Thursday, June 8th.
When is each homework due? What day of the week is that?
1. Introduction to MATLAB
Due at 11:59pm on Friday, April 14 PT
2. Systems of Linear Equations
Due at 11:59pm on Friday, April 28 PT
3. Matrix Algebra
Due at 11:59pm on Friday, May 12 PT
4. Eigenvalues & Diagonalization
Due at 11:59pm on Friday, May 26 PT
5. Orthogonality & Least Squares
Due at 11:59pm on Friday, June 9 PT
Exercise 1.2
Define each letter of your first and last names to be the number
corresponding to its place in the alphabet. Then set your name, without any
spaces, equal to the sum of the letters.
>> t=20;i=9;c=3;a=1;n=14;y=25;u=21;m=13;o=15;
>> TianyuMiao=t+i+a+n+y+u+m+i+a+o
TianyuMiao =
128
Exercise 1.3
Suppose we want to evaluate the expression
Enter the command >> z = 25-(100-7exp(5+cos(pi/3))
You will get an error message. Use the up-arrow to bring this line back, and
then use the left and right arrow keys to correct the error(s). Include the
wrong command, the error message, and your fix in your homework. [Hint:
Multiplication and parentheses are good things to check.]
>> z = 25-(100-7*exp (5+cos(pi/3)))
z =
1.6378e+03
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Exercise 1.4
Compute the derivative of log(cos(t)-3*s) with respect to t. Next, differentiate
the same function with respect to s instead. Include the input and output in
your Word document.
>> syms s t
>> diff(log(cos(t)-3*s),t)
ans =
sin(t)/(3*s - cos(t))
>> diff(log(cos(t)-3*s),s)
ans =
3/(3*s - cos(t))
Exercise 1.5
Compute arcsin(1) using MATLAB. Include the outputs in MATLAB. [Hint: Start
by looking at help sin, or perhaps doc arcsine.]
>> asin(1)
ans =
1.5708
Exercise 1.6
Input the following matrix into MATLAB Include your commands and outputs in
MATLAB.
>> Fibonacci= [1 1 2 3; 5 8 13 21; 34 55 89 144; 233 377 610 987]
Fibonacci =
1 1 2 3
5 8 13 21
34 55 89 144
233 377 610 987
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Exercise 1.7
Using the commands introduced above, construct a new matrix with whatever
name you like from Fibonacci that consists of the elements in the last two
rows and the middle two columns of Fibonacci. (The result should therefore be
a 2×2 matrix.) Be sure to include the command you used and the resultant
output in your Word document.
>> Fibonacci(3:4,2:3)
ans =
55 89
377 610
Exercise 1.8
Create two random 4×4 matrices named A and B. Do you expect A + B and B
+ A to be equal? Compute those two sums using MATLAB. Are they in fact the
same?
I thought they will be different (I thought it will generate each time they
calculate) but in fact they are the same.
>> A=rand(4)
A =
0.6557 0.6787 0.6555 0.2769
0.0357 0.7577 0.1712 0.0462
0.8491 0.7431 0.7060 0.0971
0.9340 0.3922 0.0318 0.8235
>> B=rand(4)
B =
0.6948 0.4387 0.1869 0.7094
0.3171 0.3816 0.4898 0.7547
0.9502 0.7655 0.4456 0.2760
0.0344 0.7952 0.6463 0.6797
>> A+B
ans =
1.3506 1.1175 0.8424 0.9863
0.3528 1.1393 0.6610 0.8009
1.7994 1.5086 1.1516 0.3732
0.9684 1.1874 0.6781 1.5032
>> B+A
ans =
1.3506 1.1175 0.8424 0.9863
0.3528 1.1393 0.6610 0.8009
1.7994 1.5086 1.1516 0.3732
0.9684 1.1874 0.6781 1.5032
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help