Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4. (15) The MATLAB Onramp tutorial provided you with an interactive introduction to the MATLAB commands that we will be using this semester in the
4. (15) The MATLAB Onramp tutorial provided you with an interactive introduction to the MATLAB commands that we will be using this semester in the course. I hope that you have taken not just the time to complete the Onramp tutorial, but have also made an effort to understand the command syntax and usage. Please refer to the Onramp tutorial information or the MATLAB help command whenever you have questions about command syntax and usage. In this computer lab exercise, we will (1) review some frequently used, essential commands; (2) work through a couple of short MATLAB program examples; and (3) write a MATLAB script to generate and plot data. As you type each MATLAB command, think about what the command means and try to predict the output that is echoed back to your screen before hitting enter. Part 1: Vectors, matrices, and the colon operator 1. Why store data in vectors? 2. Exercise: a) In the command window, type a % followed by your name, HW2, and your lecture time. b) Define two matrices, a and b, that are 3x3. Choose any numbers that you want for values of the elements. i. Suppose you want to multiply each element in a by the corresponding element in b. This mathematical operation is called element-wise multiplication. In MATLAB, you would write at the command prompt: a. *b This command can also be written as: times (a,b) ii. Now try this without the 'dot' after the a. What happened? This operation is called the matrix product of the matrices. c) Define the following matrices: d=1:6; e=10:15; f= [1 4 9 16 25 36). Perform the following operations and describe the output. 3*d d.^2 f./d d. *e f.^(1/2) sqrt(f) 1./sin(e) 1./(2*e+1) (5) Turn in: Highlight the command window commands/output for this exercise. Print selection and turn in this printout with your annotations for the output from part c
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started