Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer the following questions: [CLO 2.4] 1. Use colon notation to create vectors identical to the following created with the linspace() function: (a) x =

image text in transcribedimage text in transcribed

Answer the following questions: [CLO 2.4] 1. Use colon notation to create vectors identical to the following created with the linspace() function: (a) x = linspace(-2, 9, 12) (b) y = linspace(8,-1, 10) (c) z = linspace(7, 1, 9) 1 -x/2 e 27 2. Use MATLAB to plot the function f(x) Use suitable axis labels and a title. in the interval x (-7,7). 3. The following matrix is entered in MATLAB: >> A = [linspace(12, 10, 3); 1, 2, 3; 4:0.5:5] Use colon notation to write a single-line MATLAB command to multiply the second row by third column and assign the result to the variable 4. Consider the electric circuit shown. The charge on the capacitor q(t) as a function of time can be computed as Switch Battery Capacitor Inductor w Resistor 2 1 q(t) = qoe-Rt/(21) cos R 2L LC where t = time, qo = the initial charge, R = the resistance, L = inductance, and C = capacitance. (a) Write a MATLAB function that takes as arguments t, qo, R, L, and C. It computes the charge on the capacitor at a given time instant t. Run the 1 Numerical Methods in Computer Engineering function from the command window with the values: t = 0.8, qo = 10, R = 60, L = 9, and C = 0.00005. What is the result? (b) Write an anonymous function that computes the charge at time t for qo = 10, R = 60, L = 9, and C = 0.00005. (c) From the command window, use the function in part (b) to plot g(t) from t = O to 0.8. (Hint: use plot() function]. 5. Write a MATLAB function that reads as input a numeric grade from 0 to 100 and returns a letter grade. It displays an error message and terminates in the event that the user enters a value less than zero or greater than 100. Test your function in the command window. 6. Assume the following matrix X is stored in the current workspace: 2 4 8 6 X = 1 7 3 4 3 5 6 9 1 2 4 5 Create a new matrix Y from X which will produce the following matrix: Y = 1 7 3 3 5 6

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

How would you rate Hsiehs leadership using the Leadership Grid?

Answered: 1 week ago

Question

Consider this article:...

Answered: 1 week ago

Question

2. Enrolling employees in courses and programs.

Answered: 1 week ago

Question

1. Communicating courses and programs to employees.

Answered: 1 week ago

Question

6. Testing equipment that will be used in instruction.

Answered: 1 week ago