Lecture8_Matlab_Intro_2


Now, let's start doing more examples in Matlab.
Before you start your script, let's create sections for different tasks:
Type the percentage sign followed by a 'space', then type the name (title) of the section. I created 6 sections below, with several random letters in the sections.


Go to 'publish' to publish your script into an html file.


Having the '%' sign and titles, Matlab will automatically recognize the sections and provide a nice layout for you in the published html file.


For the following tasks, please use the sections deviders, and give names/titles for each section. 




Task 1:
1) Create a new script file and save it under a proper directory. (no 'space' in the directory path, suggested: M:\Engr104\Matlab).


Type the following code in your script window: (solve the quadratic equation).

Before a script file can be executed it has to be saved. Choose Save As…from the File menu (be sure you’re at your correct directory), and enter name of file, example1.m.


2) Type the following script and run:
x = 3.5;
y = 9.4;
h = sqrt (x2 + y^2)
  (x2 is not a typo).

You don't have x2 be assigned to any value here but you still get a result. Why?
The reason is you still have the old x2 value stored in the memory from the first example.

So now change x2 to x^2, you will get the good results.

Task 2:
1) Type the follwing equations and publish them along with Task 1, in the same html file.
Compute r*cos(θ) if r=6.4 cm and θ = 28 degrees
Compute (v^2/g) * sin(θ) if v=45 m/s, g=9.81m/s^2 and θ = 28 degrees

2) Work on the problems in the online PDF file, publish your sections.
(Y = log(X) returns the natural logarithm ln(x) of each element in array X.)


Send eveything in one 'html file and send it to homeworkflc02@gmail.com by Monday.
Again, work on your Exam 1, review the videos/lectures/notes.