MATLAB Assignment ( due today 11pm USA time ) now its 2:17 pm..
Carefully read through and complete the following assignment. The work should be done completely.
– Become familiar with the Matlab environment
– Learn to use the help feature.
– Learn to create different types of variables: scalars
– Learn to do mathematic operations in Matlab
– Become familiar with some Matlab built-in functions
1. Open up Matlab on the computer. Familiarize yourself with the Matlab layout. Can you find the Command Window, the Workspace, Current Folder, the Command History, the Matlab Editor, and the Home tab? Ask your TA if you are unable to find these windows and tab.
2. One way to record your session in Matlab is using the diary command. At the command prompt (>>) in your command window, type the following:
>> help diary
to learn more about the diary command. Note, donâ€™t type â€œ>>â€ that is just to indicate the command prompt.
3. Create a diary file named FirstName_LastName_Rec#_MATLAB1.txt by doing the following command:
>> diary FirstName_LastName_Rec#_MATLAB1.txt
(note where is says FirstName and LastName in the filename, put your first and last name, respectively. Where it has the # put your rection number: 444.
4. Let us try some simple operations. Carry-out the following commands at the command prompt:
>> 3 + 4
>> 4 * 5
What is 100 divided by 2? Use Matlab to determine the answer.
5. Let us try declaring some variables. Carry-out the following commands:
>> num = 3
>> dec = 5.6
>> myString = â€˜I am a Collage Studentâ€™
â€œ;â€ in Matlab is used to suppress output of a command to the screen. Repeat the three commands above but with â€œ;â€ at the end of each command, i.e.:
>> num = 3;
>> dec = 5.6;
>> myString = â€˜I am a College Studentâ€™;
What happens now?
6. Write the following lines of code:
>> a = 5;
>> b = 4;
>> c = a+b;
7. What does the disp command do? Do help disp to learn more about the display command. Describe what the code above in 6 did.
8. Write the following lines of code:
>> x = 9;
>> y = 5;
>> z1 = x * y;
>> z2 = x/y;
>> z3 = rem (x, y);
>> z4 = sqrt(x);
9. What does the code given above in 8 do?
10. Matlab play: Try some other commands to become familiar with the environment. Example: round(1.5), cos(2), clc.
11. Type the diary command again to save the file and stop recording all your command entries.
Submit your FirstName_LastName_Rec#_MATLAB1.txt file and your answers to the questions above in a separate file name: FirstName_LastName_Rec#_MATLAB1_ans.doc