Vous êtes sur la page 1sur 2

George Nessim Math 2373 TA: Eyerusalem Woldegebreal Lab 01 1.

27+48=75 sqrt(16)=4 27-48=-21 27*48=1296

27/48=.5625

16.5*(38.5+71/40)=664.5375

This first step was used to help us understand how calculations are to be made in MATLAB. We did not use an equals sign but instead input the problem into the command and hit enter, MATLAB then returned an answer to the problem automatically.

2. 5*3^2=45 (5*3)^2 =225 5*(3^2)=45

The second step allowed us to realize that MATLAB adheres to the order of operations in mathematics as a whole and when not commanded via parenthesis to do so it will follow the simple order. 3. X=7 X+Y=16 X*Y=63 Y=9 X/Y=7/9 X^2=49

Step three simply taught us how to assign variables specific values and then use them to make calculations. By selecting a variable and using the equals sign you are assigning that variable the value. Once you have done so for the rest of your lab that variable can be used in place of the specified integer which you set it equal to. 4. X=25 X+Y=65 XY=1000 Y=40 8X/5=40 6X+9Y=510

X/Y=.625

This example now showed us that not only will you be able to assign variables specific values but these will also adhere to the simple rules of operations in mathematics. 5. 4+5=9 ans+10=19 ans+100=119

This step clearly exemplified the use of ans instead of retyping in the previous value in the next calculation. This is very useful when the calculation used before has many digits therefore instead of making a mistake we can just use the ans command.

George Nessim Math 2373 TA: Eyerusalem Woldegebreal 6. X=1, Y=3, 3*X+7*Y, 9*Y, (5*Y)/(2*X*Y) X=1, Y=3, ans=24, ans=27, ans=2.5 This command shows that when calculating multiple values using the same variables you can separate all the information using a comma and then a space and then MATLAB will give you the ans to each of the commands in the order you put them in all at once saving you time. 7. who and clear This step teaches what the commands who and clear do. Command who simply lists out all of the variables which you have assigned a value and therefore makes it simple to recall what variable you are using for what or what the value of a specified variable is. Command clear clears all of the previously stored variables and there variables so that you can begin assigning variables again from a clear slate of storage. 8. Dog=3 DOG=7

This step teaches us that variables can be complete words and that you can clear only one variable instead of all of them by inputting the command clear Dog and therefore the variable Dog is cleared but the variable DOG is still in use. 9. Pi % MATLAB uses pi for 3.14159 This step teaches the usage of the percent sign as a comment. In the command prompt when entering the percent sign the program will completely disregard anything typed after it in that command and therefore you can add comments to your calculations without confusing the program. 10. 5+pi 5*pi

We simply learn in the step that is denoted pi in the commands of MATLAB because it simply is easier to use something easily accessible on the keyboard than to look for symbols. We also note that you cannot enter the command 5pi but must always symbolically inform the operations but typing 5*pi so that the prompt understands what you want.

Vous aimerez peut-être aussi