Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask MATLAB Expert

Assignment

1. Revisiting MATLAB anonymous functions and basic logic operations.

a) Use both "polyval" and an anonymous function to calculate the following:

i. 4??4 + 2??2 + ?? - 19 at x = 1,5,10,15
ii. ??2 - 5 at x = 1,3,12,20
iii. 5??3 + 36?? + 8 at x = -5,-1,3,8

b) Using basic logic operators, answer the following questions using MATLAB

i. Create two vectors of length 10 of your choice, and label them x and z.
ii. Show, element by element, where x and z are equal.
iii. Show, element by element, where x is greater than z.
iv. Show, element by element, where x is less than or equal to z.
v. Find the elements where x is greater than z.
vi. Find the elements where z is less than or equal to x.
vii. Replace the elements in (vi) with values 10 times their original value in a single operation.

2. User-defined input-output and logical statements.

a) Consider the following function:
?? = e3x^2+(4/5)x + 36?? + 1

It is desired that this function be evaluated for a variety of user-defined values of x. Create a script file/segment of code that will allow the user to neatly and professionally input a scalar OR vector value of x. Evaluate the function at 3 user- selected points as well as a single user-defined vector input. Display the result using disp(). Be sure to include some output text in addition to displaying the function evaluation result.

b) Consider the following function:

?? (??, ??) = x2 + xy - 36?? + xe4x^2 + 9

Allow the user to input values for both x and y as scalars. Only allow the function to evaluate if the value of x is less than or equal to y. If the function is evaluated, display the value of x and y as well as the function evaluation result using a single instruction. If not, show an appropriate error message to the user and do not allow the function to be evaluated. Evaluate your code at the following points:

i. x = 5, y = 5
ii. x = 0.25, y = e3x
iii. x = 0.2, y = √(?? - 0.01)
iv. x = 1, y = 5

c) Consider the multi-variable function given by:

?? (??, ??, ??) = [√(5z2 + xy3) + 5] / (?? + ?? + ??)

allow the user to input scalar values for x,y, and z and include logic that will stop the script and display an error message if the function is singular or would result in an imaginary number for a provided set of x,y,z. If the function is allowed to evaluate, display the entered values of x,y, and z as well as the value of the function using a single instruction. Otherwise, display and error message. Evaluate at the following points (x,y,z):

i. (4,13,15)
ii. (8,-12,0.1)
iii. (0,0,0)
iv. (5,10,15)

d) Consider the case where the input to a program can be either a scalar, vector, a matrix or a combination of these. Write a program that can add, subtract, multiply or divide the input variables. Note that the division portion is not valid for matrices (we use inverses instead) - you will need to incorporate this in your code. Your program should prompt the user for the type of operation to be performed, to enter the two variables and display the results neatly (using fprintf) or the appropriate error message if the code fails to execute. Test your code using at least 7 different combinations of x and y, allowing each to be scalars, matrices of various shapes (not only square) and vectors.

e) Recall, from homework #3, the equation of motion given by:

?? = 1/2 gt2

where g = 9.81 and time is defined in seconds. Allow the user to input the total time in which he/she would like to know the position of the object. Fix your step-size at 0.1 seconds and start your vector at zero (ending at the value of "total time", which should be input as a scalar). Additionally, create a selection structure that allows the user to select which graph to plot - either the position, velocity or acceleration vs. the time vector you create. Plot the position, velocity and acceleration in 3 separate code executions for a total time of 5 seconds.

3. Working with flowcharts and code documentation.

a) Create a flowchart for the following:

i. Question 2(a)
ii. Question 2(b)
iii. Question 2(c)
iv. Question 2(e)

MATLAB, Engineering

  • Category:- MATLAB
  • Reference No.:- M92024940
  • Price:- $60

Priced at Now at $60, Verified Solution

Have any Question?


Related Questions in MATLAB

Assignment - matlab programmingusing appropriate matlab

Assignment - MatLab Programming Using appropriate MatLab syntax, write the code required to analyse and display the data as per the problem description. The order of the MatLab Program should be as follows: Variables and ...

Recitation problems -1 determine the highest real root of

Recitation Problems - 1. Determine the highest real root of f(x) = 2x 3 - 11.7x 2 + 17.7x - 5 using the Newton-Raphson method with at least four iterations. Start with an initial guess of x 0 = 3. 2. Determine the real r ...

Assignment -matlab codes and simulated model in

Assignment - Matlab codes and simulated model in simulink/matlab and truetime. 1. Matlab codes and simulink model for pid controller optimization using particle swarm optimization (PSO) my plant is integer order 1000/(s^ ...

Assignment - matlab programmingusing appropriate matlab

Assignment - MatLab Programming Using appropriate MatLab syntax, write the code required to analyse and display the data as per the problem description. The order of the MatLab Program should be as follows: Variables and ...

Assignmentafter the success of your robo-advice venture you

Assignment After the success of your robo-advice venture you decide to explore alternative sources of profitability for your company. You realize that Australian investors are often forced to chose between expensive acti ...

Assignmentq1 find the laplace transforms of the following

Assignment Q.1 Find the Laplace transforms of the following functions: (a) t 2 + at + b and (b) sin(2nΠt/T) Q.2 Find f (t) for the following F(s) = α[ f (t)]. (i) 5/(s + 3), (ii) 1/s 2 + 25, (iii) 1/s(s+1) Q.3 Find the L ...

Question a safe prime is a prime number that can be written

Question : A safe prime is a prime number that can be written in the form 2p + 1 where p is also a prime number. Write a MATLAB script file that finds and displays all safe primes between 1 and 1000.

Suppose that you have used some concept learning algorithm

Suppose that you have used some concept learning algorithm to learn a hypothesis h1 from some training data. You are interested in knowing the accuracy that the hypothesis can be expected to achieve on the underlying pop ...

Assignment details -need to write a code for connecting

Assignment Details - Need to write a code for connecting segments (Lines) a special case of TSP. The problem is to connect lines in 2d/ 3d space with path obstructions. Can you help me write the code for this? Hope you m ...

Assignment -data is given on which want to do computational

Assignment - Data is given on which want to do computational production planning using Metaheuristic MATLAB Programming: 1) Ant Colony Algorithm on both Partial and Total Flexible Problem. 2) Bee Algorithm on both Partia ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As