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

  Write the matlab code for nested for loops

write the MATLAB code for 3 nested for loops. Use the same variable naming scheme as above, and have the following number of iterations

  Matlab i uploaded the requirments

i uploaded the requirments

  With a time step of h 01 in each case use starting values

dydt yt- yt2 1 le t le 2 y1 1approximate the solution to the above initial value problem usinga 2-step

  Benefits and disadvantage using of mimo system in lte

What are benefits and disadvantage using of MIMO system in LTE - What are signal transmissions and reception techniques involve in MIMO system in LTE

  Estimate the numerical wave speed

Scheme and try a couple of values for α, one close to 1 and the other not. Convince yourself that a smaller Δt is not necessarily a better choice.

  Design an appropriate controller to ensure the steady state

NHE2487 Control Systems - University of Huddersfield - Draw the block diagram and derive the transfer function of the closed loop liquid level control system

  Write a program that examines student in basic arithmetic

Write a program that examines the student in the basic arithmetic operations (summation, subtraction and multiplications).

  Undertake in-depth design of digital filters

Designing a low pass FIR filter using Windowed Fourier Series approach - Develop and implement signal processing algorithms in Matlab

  Implement the fdtd method in a matlab program

ECE 452 - Derive the stability condition for each of the above time discretization methods and Derive the FD equations for nodes on the left, right, top and bottom boundaries.

  Derive finite difference equations for all interior nodes

Derive finite difference equations for all the interior nodes - develop a MATLAB code, and determine temperatures at all interior nodes.

  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.

  Write matlab function that calculate mean concrete strength

Write a MATLAB function that computes the ratio of concrete strengths above 30 MPa for each type of concrete. The output should be a row vector

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