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

  Matlab program to compute how much money will accumulate

Write a MATLAB program to compute how much money will accumulate in 5 years in the account and in any CDs you buy. Run the program for two different savings interest rates: 4 percent and 5 percent.

  Matlab program which will determine your vehicle fuel usage

Create a MATLAB program which will determine your vehicle fuel usage (MPG, miles/gallon) rating for a user defined number of trips ('for' repetition structure). Review the voiceover supplied for an example of the required input/output from this progr..

  Write a function in matlab that lets the user define matrix

You need to write a function in matlab that lets the user define two matrices of any size, then multiplies those matrices without using the built-in matrix.

  Solve the given problem by matlab

Consider the system of Fig. and plot the response to the initial conditions (0) = 2cm, 1(0) = 0 for the values of the damping factor ? = 0.1,1.

  Write a computer program to implement a discrete hopfield

Write a computer program to implement a heteroassociative neural net using the Hebb rule to set the weights (by outer products). The program should read an x vector from a 9 x 7 array - Write a computer program to implement a discrete Hopfield net ..

  Calculate the derivative of the cost

MCD 4140: Computing for Engineers - You have been asked to manage a project to install a pipeline from an offshore gas platform to an onshore gas processing plant, and to find the cheapest design that is possible.

  Study and simulate a digital baseband modulation transmitter

Study and simulate a digital baseband modulation transmitter by using MATLAB software. In this lab, we will learn how to generate the transmitted baseband.

  Demonstrate effective research and report writing skills

MP 3680 Engineering simulation - kinetic analysis - Analyse how certain factors are affecting the accuracy of a simulation and evaluate industry standard

  Describe the process to store the value for each row

Assignment - MatLab Programming - Describe the process to store the value for each row and column for an unknown number of rows and columns

  Evaluate the maximum value of the time constant

Evaluate the maximum value of the time constant - Compute the coding efficiency of above Huffman code and Compute the average length of codewords

  The concentration of medication in the blood declines

After a dose, the concentration of medication in the blood declines due to metabolic processes. The half-life of a medication is the time required after an initial dosage for the concentration to be reduced by one-half.

  Write matlab function that used to solve quadratic equation

Write a MATLAB function that can be used to solve a quadratic equation if answers are real numbers (you have to do following steps): 2ax2 - 3bx + 4c = 0. The inputs to the function are the three coefficients a, b, and c.

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