Write a Matlab script to generate an array

Assignment Help MATLAB Programming
Reference no: EM132369444

Assignment -

1. Write a Matlab script to generate an array of 100 random samples between -5 and 5. The script should then copy the samples one by one to a new array, and check if they are within a limit range set between variables min and max, set at -2 and 2, respectively. If a sample is outside the range, it should be set to the limit value. Using the script, plot both arrays on the same figure.

2. Write a Matlab script to generate the plots of y = 5x2, where x is within [0, 10].

  • The step size of x in the first plot is 0.2.
  • The step size of x in the second plot is 0.5.
  • The step size of x in the third plot is 1.
  • The step size of x in the fourth plot is 2.

In the script, use the subplot command to display four plots on one figure.

  • Plot 1 should choose the red color.
  • Plot 2 should choose the blue color.
  • Plot 3 should choose the green color.
  • Plot 4 should choose the black color.
  • The point format in each plot should choose '+';.
  • The connection between dots should be dashed '--'.

3. Write a Matlab function that will accept an array of numbers. The function should sort the values from lowest to highest using two loops. Do not use the sort() or similar pre-made Matlab functions.

(Hint: one way to do this is a bubble sort algorithm. Use a "for" loop that repeats n-1 times, where n is the number of elements in the array. Within that loop, use another "for" loop that indexes through each element of the array (from 1 to n-1), compares it with the next highest element, and switches them if the first number is larger than the second.)

Reference no: EM132369444

Questions Cloud

Describe the management reporting systems and e-commerce : HI5019 Strategic Information Systems for Business and Enterprise Individual Assignment - Case Study - Rainbow Illusion. Describe the management reporting system
How do you plan the people working in the factory : How do you plan the people working in the factory? Think about various functions, organization chart. Who are your customers? Find targeted customers
Critical infrastructure and application of countermeasures : Conduct a literature review on emerging threats and challenges faced by the U.S. critical infrastructure and the application of countermeasures
Create five annotations for five different sources : How does it compare with other sources in your bibliography? How can you use this source in your research project? Has it changed how you think about your topic
Write a Matlab script to generate an array : Write a Matlab script to generate an array of 100 random samples between -5 and 5. The script should then copy the samples one by one to a new array
What demographic were the largest consumers of gangsta rap : How do you respond to this criticism? Why do you think this comparison to minstrelsy was made? What demographic are/were the largest consumers of gangsta rap?
Do you think the violence in hip hop lyrics is criticized : Do you think the violence in hip hop lyrics is criticized more than the violence in other forms of entertainment? If yes, why?
Write an analysis paper on drug policies in the united state : Describe the history of drug use and policy legislation in the United States. Write an analysis paper on drug policies in the United States.
What is the maximum power production of the system : MAE 204 Thermodynamics Assignment, University at Buffalo, USA. Given the information, what is the maximum power production of the system, in MW

Reviews

Write a Review

MATLAB Programming Questions & Answers

  Finite difference method

Use the finite difference method to calculate the temperature at the point specified since it is easier.

  Determine the necessary shell temperature

In a shell-and-tube heat exchanger, one fluid passes through a central tube while another fluid flows through an outer shell in the opposite direction. The purpose is to heat the fluid passing through the central tube.

  Find the integral of a function at an arbitrary location

Write a Matlab function to perform numerical integration of a set of evenly spaced data points using the trapezoidal rule

  Compute the speed of single-stage planetary gear train

Write a MATLAB function [speed] = planetary (N, emesh, first, last, arm) that computes the speed of a given link in a single-stage planetary gear train.

  Calculate and plot the error in the numerical derivative

Write a program to calculate and plot the error in the numerical estimate of the derivative.

  Create the graph using matlab functions

Create the graph, which contains a piecewise function where a line exists in the first interval, a parabola in the second interval, and the sine function in the third interval.

  Develop a simulation program

Develop a simulation program

  Create a vector in matlab

Create a three dimensional diagram of function.

  Open a named pipe and to read data from the pipe

Open a named pipe and to read data from the pipe in matlab

  Write the commands that will create the matrix

Write the commands that will create the matrix.

  Lagrange interpolating polynomial of degree

Lagrange interpolating polynomial of degree

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd