Activity: MATLAB Exercises Objectives • Create well-documented MATLAB script • Practice MATLAB commands for mathematical computations • Practice MATLAB commands for working with variables, vectors,...

1 answer below »
DUMMY


Activity: MATLAB Exercises Objectives • Create well-documented MATLAB script • Practice MATLAB commands for mathematical computations • Practice MATLAB commands for working with variables, vectors, and matrices • Practice MATLAB commands for conditions • Practice MATLAB commands for simple loops • Practice MATLAB commands for 2D plots Procedure Start by creating a MATLAB script (m-file) for ALL the MATLAB work for this activity. Make sure to document your script using comments. 1. In the script, enter the commands to perform the following three calculations: 2. In the script, complete the following steps A. ) Use 3 different methods to define the row vector: j = [-6 -3 0 3 6 9 12] B. ) Solve the polynomial and display the resulting k vector when plugging in the vector j defined in part 2A: k = 2j2 -6j +13 3. In the script, define the variable "BD" as the number of the month you were born For example if my birthday is in October, BD would equal 10 With this variables defined, write an else-if-elseif statement based on the following conditions: You are born in a Spring month (March, April, May) so "spring" is equal to 1 You are born in a Summer month (June, July, August) so "summer" is equal to 1 You are born in a Fall month (September, October, November) so "fall" is equal to 1 You are born in a Spring month (December, January, February) so "winter" is equal to 1 Verify that the code works for a birthday month in each season. 4. Write a for loop to compute factorial of 100, i.e. compute the product of first 100 natural numbers. Do not use the pre-existing "prod" or "factorial" functions in MATLAB, you must use the for loop along with simple operations like multiplication. At the end of the for loop, write a statement to print the final output in the command window. 5. At the end of the script define a MATLAB function whose name is of your choice. The function must take as input a vector of length 5 with numbers in it, and produce as output the sum of squares of those numbers. In the script write a command to call this function and print the sum of squares of 2, 4, 6, 8, 10. 6. In the script, define appropriate vectors and plot the following two functions in a single plot. Make sure to use different line attributes to differentiate the two curves, add a title to the plot, label the axes, and add a legend. Submission Criteria Publish your script as a pdf file by clicking the 'PUBLISH' tab on the top menu, clicking the 'Publish' button for the drop-down menu, choosing 'Editing Publish Options', changing the Output File Format from html to pdf, and clicking 'Publish'. See screenshots below. Submit a single pdf file for this activity.
Answered 38 days AfterAug 25, 2021

Answer To: Activity: MATLAB Exercises Objectives • Create well-documented MATLAB script • Practice MATLAB...

Saiyan answered on Oct 02 2021
142 Votes
Matlab Assignments
Question-1
Explanation-
A- For calculating square root of 5 ‘sqrt’ command is
used.
B- For calculating mod of -6 ‘abs’ command is used.
C- For calculating exponential of ‘exp’ command is used.
Code:
clear all
close all
clc
% Question 1-A
x=5*sqrt(5) - (60/5) + (9*3);
% Question 1-B
y=4^3 - abs(-6) - 9*pi;
% Question 1-C
z=(cos(pi/3))^2 - log(1) + 9*exp(-1);
Output:
Question-2
For solving the polynomial the dot operator is used to multiply vectors
where required.
Code:
clear all
close all
clc
% First Method
j1=[-6,-3,0,3,6,9,12];
% Second Method
j2=[-6 -3 0 3 6 9 12];
% Third Method
j=-6:3:12
% Solving the polynomial
k=2*j.^2 - 6.*j + 13
Output:
Question-3
-Respecting numbers according to month are...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here