$29
On the following page is the first “A” part for HW1.
Here’s the purpose of the HW (i.e. what I hope you’re geFng out of it):
• 1.1 involves no thought. It’s just mechanics. This problem just allows you and the graders to make sure everyone remembers how to open MATLAB, make and upload .m (script) and .pdf (plot) files, and see where the “comments” field is on the HW file upload screen.
This problem sounds easy, but here’s some known issues to watch out for:
• Infrequently the plot prints out strangely enlarged so that the grader can’t see the enRre plot and axes. YOU are responsible for catching that before your HW is submiVed and making sure you create & submit the full plot clearly (that’s why we’re pracRcing today!)
• If you “print” your plot to a file (like PDF1_1.pdf) the file will be saved in your “local” MATLAB directory. That may not be where you think it is, so you might have trouble finding your file to submit. If in doubt, look at what “folder” you’re in at the top of your MATLAB window, or you can type “pwd” in MATLAB and it will tell you your current directory.
• SomeRmes copying-and-pasRng my commands from this page gives you an error. Especially if there’s single quotes (‘). If so, just carefully type what you see here directly in MATLAB and it should work. I’m not really sure why!
• MOST IMPORTANTLY!! You need to submit ALL required files and the comment in Carmen AT THE SAME TIME. If you realize you made a mistake in (say) one of the files, you can NOT just go back and resubmit that one file. It will overwrite your enRre submission with JUST THAT FILE, so the graders won’t see the rest of your homework. This becomes REALLY important when you get to later HWs where you might be submiFng two different codes (each with their own plots). If you change even one file, you have to resubmit EVERYTHING.
Bo@om line: Always check that all three submissions are showing properly before you log out of Carmen!!
• For 1.2, I just want to really make sure you know how to mulRply and transpose matrices according to linear algebra rules. Also, I want you to see for yourself that the order you mulRply matrices maVers (in general AB ≠ BA), and especially make sure you know the difference between .* and * in MATLAB.
HW1A (1.1, 1.2) Due by Beginning of Class, Friday
1.1 Easy MATLAB task – just to ensure we get I/O working for submiFng codes and grading.
2 pt Create a MATLAB script m-file called HW1_1.m which does all of the following:
a) Creates a plot of y = 10 x2 over the range 0 to 15 using the following commands:
x = 0:15;
y = 10 * x .^ 2;
plot(x,y,'-^'); %plots with line AND triangles
b) labels x and y axes
xlabel('This is X')
ylabel('This is Y')
c) Rtles the plot with your name (EXCEPT replace with YOUR name of course):
title('Ken Gordon')
Then use the following command to save the plot as a .pdf file called PDF1_1.pdf:
print –dpdf PDF1_1
Please submit the following three things ONLINE in the HW1A assignment folder:
i. Your m-file script HW1_1.m
ii. Your .pdf plot PDF1_1.pdf
iii. The following words in the assignment comment secVon: “ Perfect! ”.
HINT: Always check that all three submissions are showing properly before you log out of Carmen.
Read the cauRonary notes on the last page.
1.2 Fundamental linear algebra, BY-HAND
X =
1 0
−1
2
13 pts A) Given the following vectors/matrices,
2 ,
A =
−3
−2
evaluate the following six algebraic expressions:
a) X Y b) Y X c) A Y d) Y A e) B3
f) BT A
• Show your work! Don’t just write the final answer down. Write the steps
showing how you’re mulRplying and adding all the terms. You can check your answers in MATLAB, but I’m not grading you on that – grades are based on you demonstraRng you understand all calculaRon steps by-hand.
3
1
, Y =
2
,
0
3
0
1
B =
2
3
• If any of the expressions can not be evaluated, then explain why.
B) For each expression above, write down what you would type in MATLAB to calculate it (e.g. for the linear algebra expression B3 in part (e), I would just type B ^ 3 in MATLAB).
C) Evaluate the following four MATLAB-type expressions by-hand (again, sure, you can always check your work in MATLAB, but I’m looking for all your calculaRon steps by-hand)
g) A .* A h) Y / 10 i) B ^ 2 j) B .^ 2
Please submit the following:
• ON-PAPER (in class): All your (by-hand) calcu